@@ -3410,7 +3410,7 @@ fn test_htlc_ignore_latest_remote_commitment() {
3410
3410
check_added_monitors!(nodes[0], 1);
3411
3411
check_closed_event!(nodes[0], 1, ClosureReason::HolderForceClosed);
3412
3412
3413
- let node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
3413
+ let node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0) ;
3414
3414
assert_eq!(node_txn.len(), 3);
3415
3415
assert_eq!(node_txn[0], node_txn[1]);
3416
3416
@@ -4828,7 +4828,7 @@ fn test_claim_on_remote_sizeable_push_msat() {
4828
4828
check_added_monitors!(nodes[0], 1);
4829
4829
check_closed_event!(nodes[0], 1, ClosureReason::HolderForceClosed);
4830
4830
4831
- let node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
4831
+ let node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0) ;
4832
4832
assert_eq!(node_txn.len(), 1);
4833
4833
check_spends!(node_txn[0], chan.3);
4834
4834
assert_eq!(node_txn[0].output.len(), 2); // We can't force trimming of to_remote output as channel_reserve_satoshis block us to do so at channel opening
@@ -5034,7 +5034,7 @@ fn test_static_spendable_outputs_justice_tx_revoked_htlc_timeout_tx() {
5034
5034
check_closed_event!(nodes[0], 1, ClosureReason::CommitmentTxConfirmed);
5035
5035
connect_blocks(&nodes[0], TEST_FINAL_CLTV - 1); // Confirm blocks until the HTLC expires
5036
5036
5037
- let revoked_htlc_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
5037
+ let revoked_htlc_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0) ;
5038
5038
assert_eq!(revoked_htlc_txn.len(), 2);
5039
5039
check_spends!(revoked_htlc_txn[0], chan_1.3);
5040
5040
assert_eq!(revoked_htlc_txn[1].input.len(), 1);
@@ -7839,7 +7839,7 @@ fn test_bump_penalty_txn_on_revoked_htlcs() {
7839
7839
check_closed_event!(nodes[1], 1, ClosureReason::CommitmentTxConfirmed);
7840
7840
connect_blocks(&nodes[1], 49); // Confirm blocks until the HTLC expires (note CLTV was explicitly 50 above)
7841
7841
7842
- let revoked_htlc_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap();
7842
+ let revoked_htlc_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0) ;
7843
7843
assert_eq!(revoked_htlc_txn.len(), 3);
7844
7844
check_spends!(revoked_htlc_txn[1], chan.3);
7845
7845
@@ -8100,22 +8100,26 @@ fn test_counterparty_raa_skip_no_crash() {
8100
8100
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
8101
8101
let channel_id = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known()).2;
8102
8102
8103
- let mut guard = nodes[0].node.channel_state.lock().unwrap();
8104
- let keys = guard.by_id.get_mut(&channel_id).unwrap().get_signer();
8103
+ let per_commitment_secret;
8104
+ let next_per_commitment_point;
8105
+ {
8106
+ let mut guard = nodes[0].node.channel_state.lock().unwrap();
8107
+ let keys = guard.by_id.get_mut(&channel_id).unwrap().get_signer();
8105
8108
8106
- const INITIAL_COMMITMENT_NUMBER: u64 = (1 << 48) - 1;
8109
+ const INITIAL_COMMITMENT_NUMBER: u64 = (1 << 48) - 1;
8107
8110
8108
- // Make signer believe we got a counterparty signature, so that it allows the revocation
8109
- keys.get_enforcement_state().last_holder_commitment -= 1;
8110
- let per_commitment_secret = keys.release_commitment_secret(INITIAL_COMMITMENT_NUMBER);
8111
+ // Make signer believe we got a counterparty signature, so that it allows the revocation
8112
+ keys.get_enforcement_state().last_holder_commitment -= 1;
8113
+ per_commitment_secret = keys.release_commitment_secret(INITIAL_COMMITMENT_NUMBER);
8111
8114
8112
- // Must revoke without gaps
8113
- keys.get_enforcement_state().last_holder_commitment -= 1;
8114
- keys.release_commitment_secret(INITIAL_COMMITMENT_NUMBER - 1);
8115
+ // Must revoke without gaps
8116
+ keys.get_enforcement_state().last_holder_commitment -= 1;
8117
+ keys.release_commitment_secret(INITIAL_COMMITMENT_NUMBER - 1);
8115
8118
8116
- keys.get_enforcement_state().last_holder_commitment -= 1;
8117
- let next_per_commitment_point = PublicKey::from_secret_key(&Secp256k1::new(),
8118
- &SecretKey::from_slice(&keys.release_commitment_secret(INITIAL_COMMITMENT_NUMBER - 2)).unwrap());
8119
+ keys.get_enforcement_state().last_holder_commitment -= 1;
8120
+ next_per_commitment_point = PublicKey::from_secret_key(&Secp256k1::new(),
8121
+ &SecretKey::from_slice(&keys.release_commitment_secret(INITIAL_COMMITMENT_NUMBER - 2)).unwrap());
8122
+ }
8119
8123
8120
8124
nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(),
8121
8125
&msgs::RevokeAndACK { channel_id, per_commitment_secret, next_per_commitment_point });
@@ -8457,12 +8461,12 @@ fn test_reject_funding_before_inbound_channel_accepted() {
8457
8461
// `MessageSendEvent::SendAcceptChannel` event. The message is passed to `nodes[0]`
8458
8462
// `handle_accept_channel`, which is required in order for `create_funding_transaction` to
8459
8463
// succeed when `nodes[0]` is passed to it.
8460
- {
8464
+ let accept_chan_msg = {
8461
8465
let mut lock;
8462
8466
let channel = get_channel_ref!(&nodes[1], lock, temp_channel_id);
8463
- let accept_chan_msg = channel.get_accept_channel_message();
8464
- nodes[0].node.handle_accept_channel(&nodes[1].node.get_our_node_id(), InitFeatures::known(), &accept_chan_msg) ;
8465
- }
8467
+ channel.get_accept_channel_message()
8468
+ } ;
8469
+ nodes[0].node.handle_accept_channel(&nodes[1].node.get_our_node_id(), InitFeatures::known(), &accept_chan_msg);
8466
8470
8467
8471
let (temporary_channel_id, tx, _) = create_funding_transaction(&nodes[0], &nodes[1].node.get_our_node_id(), 100000, 42);
8468
8472
0 commit comments