-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
For the managers' CPFP we let the Bitcoin Core wallet do the work. For this we use walletprocesspsbt
and specify the information within the PSBT. But Bitcoin Core will ignore the sighash type specified inside the PSBT inputs. So we were implicitly relying on the default value of the sighash_type
parameter of the walletprocesspsbt
which happened to be what we wanted (SIGHASH_ALL
). bitcoin/bitcoin#22514 changed the default to SIGHASH_DEFAULT
, which breaks our usage.
The fix is trivial, and backward compatible with previous versions of bitcoind. We need to explicitly specify the sighash_type
parameter when calling walletprocesspsbt
:
revaultd/src/bitcoind/interface.rs
Lines 722 to 746 in 076df0d
/// Make bitcoind: | |
/// 1. Add information to the PSBT inputs | |
/// 2. Sign the PSBT inputs it can | |
/// 3. Finalize the PSBT if it is complete | |
pub fn sign_psbt(&self, psbt: &Psbt) -> Result<(bool, Psbt), BitcoindError> { | |
let res = self.make_cpfp_request( | |
"walletprocesspsbt", | |
¶ms!(Json::String(base64::encode(&encode::serialize(psbt)))), | |
)?; | |
let complete = res | |
.get("complete") | |
.expect("API break: no 'complete' in 'walletprocesspsbt' result") | |
.as_bool() | |
.expect("API break: invalid 'complete' in 'walletprocesspsbt' result"); | |
let psbt = res | |
.get("psbt") | |
.expect("API break: no 'psbt' in 'walletprocesspsbt' result") | |
.as_str() | |
.expect("API break: invalid 'psbt' in 'walletprocesspsbt' result") | |
.to_string(); | |
let psbt = | |
encode::deserialize(&base64::decode(psbt).expect("bitcoind returned invalid base64")) | |
.expect("bitcoind returned an invalid PSBT."); | |
Ok((complete, psbt)) | |
} |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working