Skip to content

Commit d3e1130

Browse files
committed
Fix some tests.
1 parent 51be419 commit d3e1130

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lightning/src/ln/channel.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7925,15 +7925,15 @@ mod tests {
79257925

79267926
macro_rules! test_commitment {
79277927
( $counterparty_sig_hex: expr, $sig_hex: expr, $tx_hex: expr, $($remain:tt)* ) => {
7928-
chan.context.channel_transaction_parameters.opt_anchors = None;
7929-
test_commitment_common!($counterparty_sig_hex, $sig_hex, $tx_hex, false, $($remain)*);
7928+
chan.context.channel_transaction_parameters.channel_type_features = ChannelTypeFeatures::only_static_remote_key();
7929+
test_commitment_common!($counterparty_sig_hex, $sig_hex, $tx_hex, &ChannelTypeFeatures::only_static_remote_key(), $($remain)*);
79307930
};
79317931
}
79327932

79337933
macro_rules! test_commitment_with_anchors {
79347934
( $counterparty_sig_hex: expr, $sig_hex: expr, $tx_hex: expr, $($remain:tt)* ) => {
7935-
chan.context.channel_transaction_parameters.opt_anchors = Some(());
7936-
test_commitment_common!($counterparty_sig_hex, $sig_hex, $tx_hex, true, $($remain)*);
7935+
chan.context.channel_transaction_parameters.channel_type_features = ChannelTypeFeatures::static_remote_key_with_anchors();
7936+
test_commitment_common!($counterparty_sig_hex, $sig_hex, $tx_hex, &ChannelTypeFeatures::static_remote_key_with_anchors(), $($remain)*);
79377937
};
79387938
}
79397939

@@ -7992,9 +7992,9 @@ mod tests {
79927992
let ref htlc = htlcs[$htlc_idx];
79937993
let htlc_tx = chan_utils::build_htlc_transaction(&unsigned_tx.txid, chan.context.feerate_per_kw,
79947994
chan.context.get_counterparty_selected_contest_delay().unwrap(),
7995-
&htlc, $opt_anchors, false, &keys.broadcaster_delayed_payment_key, &keys.revocation_key);
7995+
&htlc, $opt_anchors, &keys.broadcaster_delayed_payment_key, &keys.revocation_key);
79967996
let htlc_redeemscript = chan_utils::get_htlc_redeemscript(&htlc, $opt_anchors, &keys);
7997-
let htlc_sighashtype = if $opt_anchors { EcdsaSighashType::SinglePlusAnyoneCanPay } else { EcdsaSighashType::All };
7997+
let htlc_sighashtype = if $opt_anchors.supports_anchors() { EcdsaSighashType::SinglePlusAnyoneCanPay } else { EcdsaSighashType::All };
79987998
let htlc_sighash = Message::from_slice(&sighash::SighashCache::new(&htlc_tx).segwit_signature_hash(0, &htlc_redeemscript, htlc.amount_msat / 1000, htlc_sighashtype).unwrap()[..]).unwrap();
79997999
assert!(secp_ctx.verify_ecdsa(&htlc_sighash, &remote_signature, &keys.countersignatory_htlc_key).is_ok(), "verify counterparty htlc sig");
80008000

@@ -8011,7 +8011,7 @@ mod tests {
80118011
}
80128012

80138013
let htlc_sig = htlc_sig_iter.next().unwrap();
8014-
let num_anchors = if $opt_anchors { 2 } else { 0 };
8014+
let num_anchors = if $opt_anchors.supports_anchors() { 2 } else { 0 };
80158015
assert_eq!((htlc_sig.0).0.transaction_output_index, Some($htlc_idx + num_anchors), "output index");
80168016

80178017
let signature = Signature::from_der(&hex::decode($htlc_sig_hex).unwrap()[..]).unwrap();

0 commit comments

Comments
 (0)