@@ -1603,27 +1603,26 @@ fn test_fee_spike_violation_fails_htlc() {
1603
1603
1604
1604
// Get the EnforcingChannelKeys for each channel, which will be used to (1) get the keys
1605
1605
// needed to sign the new commitment tx and (2) sign the new commitment tx.
1606
- let ( local_revocation_basepoint, local_htlc_basepoint, local_payment_point, local_secret, local_secret2 ) = {
1606
+ let ( local_revocation_basepoint, local_htlc_basepoint, local_payment_point, local_secret, next_local_point ) = {
1607
1607
let chan_lock = nodes[ 0 ] . node . channel_state . lock ( ) . unwrap ( ) ;
1608
1608
let local_chan = chan_lock. by_id . get ( & chan. 2 ) . unwrap ( ) ;
1609
1609
let chan_keys = local_chan. get_local_keys ( ) ;
1610
1610
let pubkeys = chan_keys. pubkeys ( ) ;
1611
1611
( pubkeys. revocation_basepoint , pubkeys. htlc_basepoint , pubkeys. payment_point ,
1612
- chan_keys. get_revoke_commitment_secret ( INITIAL_COMMITMENT_NUMBER ) , chan_keys. get_revoke_commitment_secret ( INITIAL_COMMITMENT_NUMBER - 2 ) )
1612
+ chan_keys. get_revoke_commitment_secret ( INITIAL_COMMITMENT_NUMBER ) ,
1613
+ chan_keys. get_per_commitment_point ( INITIAL_COMMITMENT_NUMBER - 2 , & secp_ctx) )
1613
1614
} ;
1614
- let ( remote_delayed_payment_basepoint, remote_htlc_basepoint, remote_payment_point, remote_secret1 ) = {
1615
+ let ( remote_delayed_payment_basepoint, remote_htlc_basepoint, remote_payment_point, remote_point ) = {
1615
1616
let chan_lock = nodes[ 1 ] . node . channel_state . lock ( ) . unwrap ( ) ;
1616
1617
let remote_chan = chan_lock. by_id . get ( & chan. 2 ) . unwrap ( ) ;
1617
1618
let chan_keys = remote_chan. get_local_keys ( ) ;
1618
1619
let pubkeys = chan_keys. pubkeys ( ) ;
1619
1620
( pubkeys. delayed_payment_basepoint , pubkeys. htlc_basepoint , pubkeys. payment_point ,
1620
- chan_keys. get_revoke_commitment_secret ( INITIAL_COMMITMENT_NUMBER - 1 ) )
1621
+ chan_keys. get_per_commitment_point ( INITIAL_COMMITMENT_NUMBER - 1 , & secp_ctx ) )
1621
1622
} ;
1622
1623
1623
1624
// Assemble the set of keys we can use for signatures for our commitment_signed message.
1624
- let commitment_secret = SecretKey :: from_slice ( & remote_secret1) . unwrap ( ) ;
1625
- let per_commitment_point = PublicKey :: from_secret_key ( & secp_ctx, & commitment_secret) ;
1626
- let commit_tx_keys = chan_utils:: TxCreationKeys :: new ( & secp_ctx, & per_commitment_point, & remote_delayed_payment_basepoint,
1625
+ let commit_tx_keys = chan_utils:: TxCreationKeys :: new ( & secp_ctx, & remote_point, & remote_delayed_payment_basepoint,
1627
1626
& remote_htlc_basepoint, & local_revocation_basepoint, & local_htlc_basepoint) . unwrap ( ) ;
1628
1627
1629
1628
// Build the remote commitment transaction so we can sign it, and then later use the
@@ -1706,10 +1705,11 @@ fn test_fee_spike_violation_fails_htlc() {
1706
1705
let _ = nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
1707
1706
1708
1707
// Send the RAA to nodes[1].
1709
- let per_commitment_secret = local_secret;
1710
- let next_secret = SecretKey :: from_slice ( & local_secret2) . unwrap ( ) ;
1711
- let next_per_commitment_point = PublicKey :: from_secret_key ( & secp_ctx, & next_secret) ;
1712
- let raa_msg = msgs:: RevokeAndACK { channel_id : chan. 2 , per_commitment_secret, next_per_commitment_point} ;
1708
+ let raa_msg = msgs:: RevokeAndACK {
1709
+ channel_id : chan. 2 ,
1710
+ per_commitment_secret : local_secret,
1711
+ next_per_commitment_point : next_local_point
1712
+ } ;
1713
1713
nodes[ 1 ] . node . handle_revoke_and_ack ( & nodes[ 0 ] . node . get_our_node_id ( ) , & raa_msg) ;
1714
1714
1715
1715
let events = nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
@@ -8128,9 +8128,11 @@ fn test_counterparty_raa_skip_no_crash() {
8128
8128
let mut guard = nodes[ 0 ] . node . channel_state . lock ( ) . unwrap ( ) ;
8129
8129
let local_keys = & guard. by_id . get_mut ( & channel_id) . unwrap ( ) . local_keys ;
8130
8130
const INITIAL_COMMITMENT_NUMBER : u64 = ( 1 << 48 ) - 1 ;
8131
+ let per_commitment_secret = local_keys. get_revoke_commitment_secret ( INITIAL_COMMITMENT_NUMBER ) ;
8132
+ // Must revoke without gaps
8133
+ local_keys. get_revoke_commitment_secret ( INITIAL_COMMITMENT_NUMBER - 1 ) ;
8131
8134
let next_per_commitment_point = PublicKey :: from_secret_key ( & Secp256k1 :: new ( ) ,
8132
8135
& SecretKey :: from_slice ( & local_keys. get_revoke_commitment_secret ( INITIAL_COMMITMENT_NUMBER - 2 ) ) . unwrap ( ) ) ;
8133
- let per_commitment_secret = local_keys. get_revoke_commitment_secret ( INITIAL_COMMITMENT_NUMBER ) ;
8134
8136
8135
8137
nodes[ 1 ] . node . handle_revoke_and_ack ( & nodes[ 0 ] . node . get_our_node_id ( ) ,
8136
8138
& msgs:: RevokeAndACK { channel_id, per_commitment_secret, next_per_commitment_point } ) ;
0 commit comments