Skip to content

Commit 49ec983

Browse files
committed
Fix example spend amount
In the segwit signing example we are using the incorrect value when creating the signature - we should be using the utxo amount (input amount) not the spend amount (output spend amount). Also fixed in `rust-bitcoin` PR #2696.
1 parent fc01252 commit 49ec983

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cookbook/src/tx_segwit-v0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn main() {
204204
let sighash_type = EcdsaSighashType::All;
205205
let mut sighasher = SighashCache::new(&mut unsigned_tx);
206206
let sighash = sighasher
207-
.p2wpkh_signature_hash(input_index, &dummy_utxo.script_pubkey, SPEND_AMOUNT, sighash_type)
207+
.p2wpkh_signature_hash(input_index, &dummy_utxo.script_pubkey, DUMMY_UTXO_AMOUNT, sighash_type)
208208
.expect("failed to create sighash");
209209

210210
// Sign the sighash using the secp256k1 library (exported by rust-bitcoin).

0 commit comments

Comments
 (0)