[signer] Add an option to explicitly allow using non-ALL sighashes

Instead of blindly using the `sighash_type` set in a psbt input, we
now only sign `SIGHASH_ALL` inputs by default, and require the user to
explicitly opt-in to using other sighashes if they desire to do so.

Fixes #350
This commit is contained in:
Alekos Filini
2021-05-26 10:34:25 +02:00
parent 5633475ce8
commit 881ca8d1e3
4 changed files with 79 additions and 3 deletions

View File

@@ -63,7 +63,7 @@ mod test {
psbt.inputs.push(psbt_bip.inputs[0].clone());
let options = SignOptions {
trust_witness_utxo: true,
assume_height: None,
..Default::default()
};
let _ = wallet.sign(&mut psbt, options).unwrap();
}
@@ -80,7 +80,7 @@ mod test {
psbt.inputs.push(psbt_bip.inputs[1].clone());
let options = SignOptions {
trust_witness_utxo: true,
assume_height: None,
..Default::default()
};
let _ = wallet.sign(&mut psbt, options).unwrap();
}
@@ -96,7 +96,7 @@ mod test {
psbt.global.unsigned_tx.input.push(TxIn::default());
let options = SignOptions {
trust_witness_utxo: true,
assume_height: None,
..Default::default()
};
let _ = wallet.sign(&mut psbt, options).unwrap();
}