ChannelKeys - provide to_self_delay alongside the remote channel pubkeys
[rust-lightning] / lightning / src / ln / functional_tests.rs
index 4d2b155ce30b1ff4e1085e62df26e0debc1e6b72..240a5741b91c72fcc017254eac17038ee035909d 100644 (file)
@@ -15,7 +15,7 @@ use ln::{chan_utils, onion_utils};
 use routing::router::{Route, RouteHop, get_route};
 use ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
 use ln::msgs;
-use ln::msgs::{ChannelMessageHandler,RoutingMessageHandler,HTLCFailChannelUpdate, ErrorAction};
+use ln::msgs::{ChannelMessageHandler,RoutingMessageHandler,HTLCFailChannelUpdate, ErrorAction, OptionalField};
 use util::enforcing_trait_impls::EnforcingChannelKeys;
 use util::{byte_utils, test_utils};
 use util::events::{Event, EventsProvider, MessageSendEvent, MessageSendEventsProvider};
@@ -1612,7 +1612,7 @@ fn test_fee_spike_violation_fails_htlc() {
                let chan_keys = local_chan.get_local_keys();
                let pubkeys = chan_keys.pubkeys();
                (pubkeys.revocation_basepoint, pubkeys.htlc_basepoint, pubkeys.payment_point,
-                chan_keys.commitment_secret(INITIAL_COMMITMENT_NUMBER), chan_keys.commitment_secret(INITIAL_COMMITMENT_NUMBER - 2))
+                chan_keys.release_commitment_secret(INITIAL_COMMITMENT_NUMBER), chan_keys.release_commitment_secret(INITIAL_COMMITMENT_NUMBER - 2))
        };
        let (remote_delayed_payment_basepoint, remote_htlc_basepoint, remote_payment_point, remote_secret1) = {
                let chan_lock = nodes[1].node.channel_state.lock().unwrap();
@@ -1620,7 +1620,7 @@ fn test_fee_spike_violation_fails_htlc() {
                let chan_keys = remote_chan.get_local_keys();
                let pubkeys = chan_keys.pubkeys();
                (pubkeys.delayed_payment_basepoint, pubkeys.htlc_basepoint, pubkeys.payment_point,
-                chan_keys.commitment_secret(INITIAL_COMMITMENT_NUMBER - 1))
+                chan_keys.release_commitment_secret(INITIAL_COMMITMENT_NUMBER - 1))
        };
 
        // Assemble the set of keys we can use for signatures for our commitment_signed message.
@@ -1694,8 +1694,7 @@ fn test_fee_spike_violation_fails_htlc() {
                let local_chan_lock = nodes[0].node.channel_state.lock().unwrap();
                let local_chan = local_chan_lock.by_id.get(&chan.2).unwrap();
                let local_chan_keys = local_chan.get_local_keys();
-               local_chan_keys.sign_remote_commitment(feerate_per_kw, &commit_tx, &commit_tx_keys, &[&accepted_htlc_info],
-               BREAKDOWN_TIMEOUT, &secp_ctx).unwrap()
+               local_chan_keys.sign_remote_commitment(feerate_per_kw, &commit_tx, &commit_tx_keys, &[&accepted_htlc_info], &secp_ctx).unwrap()
        };
 
        let commit_signed_msg = msgs::CommitmentSigned {
@@ -6058,6 +6057,7 @@ impl msgs::ChannelUpdate {
                                flags: 0,
                                cltv_expiry_delta: 0,
                                htlc_minimum_msat: 0,
+                               htlc_maximum_msat: OptionalField::Absent,
                                fee_base_msat: 0,
                                fee_proportional_millionths: 0,
                                excess_data: vec![],
@@ -8132,8 +8132,8 @@ fn test_counterparty_raa_skip_no_crash() {
        let local_keys = &guard.by_id.get_mut(&channel_id).unwrap().local_keys;
        const INITIAL_COMMITMENT_NUMBER: u64 = (1 << 48) - 1;
        let next_per_commitment_point = PublicKey::from_secret_key(&Secp256k1::new(),
-               &SecretKey::from_slice(&local_keys.commitment_secret(INITIAL_COMMITMENT_NUMBER - 2)).unwrap());
-       let per_commitment_secret = local_keys.commitment_secret(INITIAL_COMMITMENT_NUMBER);
+               &SecretKey::from_slice(&local_keys.release_commitment_secret(INITIAL_COMMITMENT_NUMBER - 2)).unwrap());
+       let per_commitment_secret = local_keys.release_commitment_secret(INITIAL_COMMITMENT_NUMBER);
 
        nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(),
                &msgs::RevokeAndACK { channel_id, per_commitment_secret, next_per_commitment_point });