X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Fchannelmonitor.rs;h=1699e4827236c89ba6e1dc6fef6b7ff726db6366;hb=9fcc626ee4d23a276fc8dd87ddb2538f4d5565f9;hp=d5664e453d42e7c7ae7d4268f12acba6b2e8c265;hpb=ba50dd57868a78d00ed1a3c7a9089cf39d3ca235;p=rust-lightning diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index d5664e453..1699e4827 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -3381,6 +3381,7 @@ mod tests { selected_contest_delay: 67, }), funding_outpoint: Some(funding_outpoint), + opt_anchors: None, }; // Prune with one old state and a holder commitment tx holding a few overlaps with the // old state. @@ -3446,7 +3447,7 @@ mod tests { let mut sum_actual_sigs = 0; macro_rules! sign_input { - ($sighash_parts: expr, $idx: expr, $amount: expr, $weight: expr, $sum_actual_sigs: expr) => { + ($sighash_parts: expr, $idx: expr, $amount: expr, $weight: expr, $sum_actual_sigs: expr, $opt_anchors: expr) => { let htlc = HTLCOutputInCommitment { offered: if *$weight == WEIGHT_REVOKED_OFFERED_HTLC || *$weight == WEIGHT_OFFERED_HTLC { true } else { false }, amount_msat: 0, @@ -3454,7 +3455,7 @@ mod tests { payment_hash: PaymentHash([1; 32]), transaction_output_index: Some($idx as u32), }; - let redeem_script = if *$weight == WEIGHT_REVOKED_OUTPUT { chan_utils::get_revokeable_redeemscript(&pubkey, 256, &pubkey) } else { chan_utils::get_htlc_redeemscript_with_explicit_keys(&htlc, &pubkey, &pubkey, &pubkey) }; + let redeem_script = if *$weight == WEIGHT_REVOKED_OUTPUT { chan_utils::get_revokeable_redeemscript(&pubkey, 256, &pubkey) } else { chan_utils::get_htlc_redeemscript_with_explicit_keys(&htlc, $opt_anchors, &pubkey, &pubkey, &pubkey) }; let sighash = hash_to_message!(&$sighash_parts.signature_hash($idx, &redeem_script, $amount, SigHashType::All)[..]); let sig = secp_ctx.sign(&sighash, &privkey); $sighash_parts.access_witness($idx).push(sig.serialize_der().to_vec()); @@ -3502,7 +3503,7 @@ mod tests { { let mut sighash_parts = bip143::SigHashCache::new(&mut claim_tx); for (idx, inp) in inputs_weight.iter().enumerate() { - sign_input!(sighash_parts, idx, 0, inp, sum_actual_sigs); + sign_input!(sighash_parts, idx, 0, inp, sum_actual_sigs, false); inputs_total_weight += inp; } } @@ -3528,7 +3529,7 @@ mod tests { { let mut sighash_parts = bip143::SigHashCache::new(&mut claim_tx); for (idx, inp) in inputs_weight.iter().enumerate() { - sign_input!(sighash_parts, idx, 0, inp, sum_actual_sigs); + sign_input!(sighash_parts, idx, 0, inp, sum_actual_sigs, false); inputs_total_weight += inp; } } @@ -3552,7 +3553,7 @@ mod tests { { let mut sighash_parts = bip143::SigHashCache::new(&mut claim_tx); for (idx, inp) in inputs_weight.iter().enumerate() { - sign_input!(sighash_parts, idx, 0, inp, sum_actual_sigs); + sign_input!(sighash_parts, idx, 0, inp, sum_actual_sigs, false); inputs_total_weight += inp; } }