@@ -775,7 +775,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
775
775
let channel = Channel :: new_outbound ( & self . fee_estimator , & self . keys_manager , their_network_key, channel_value_satoshis, push_msat, user_id, config) ?;
776
776
let res = channel. get_open_channel ( self . genesis_hash . clone ( ) ) ;
777
777
778
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
778
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
779
779
let mut channel_state = self . channel_state . lock ( ) . unwrap ( ) ;
780
780
match channel_state. by_id . entry ( channel. channel_id ( ) ) {
781
781
hash_map:: Entry :: Occupied ( _) => {
@@ -847,7 +847,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
847
847
///
848
848
/// May generate a SendShutdown message event on success, which should be relayed.
849
849
pub fn close_channel ( & self , channel_id : & [ u8 ; 32 ] ) -> Result < ( ) , APIError > {
850
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
850
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
851
851
852
852
let ( mut failed_htlcs, chan_option) = {
853
853
let mut channel_state_lock = self . channel_state . lock ( ) . unwrap ( ) ;
@@ -907,7 +907,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
907
907
/// Force closes a channel, immediately broadcasting the latest local commitment transaction to
908
908
/// the chain and rejecting new HTLCs on the given channel.
909
909
pub fn force_close_channel ( & self , channel_id : & [ u8 ; 32 ] ) {
910
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
910
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
911
911
912
912
let mut chan = {
913
913
let mut channel_state_lock = self . channel_state . lock ( ) . unwrap ( ) ;
@@ -1255,7 +1255,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
1255
1255
}
1256
1256
let onion_packet = onion_utils:: construct_onion_packet ( onion_payloads, onion_keys, prng_seed, payment_hash) ;
1257
1257
1258
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1258
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1259
1259
1260
1260
let err: Result < ( ) , _ > = loop {
1261
1261
let mut channel_lock = self . channel_state . lock ( ) . unwrap ( ) ;
@@ -1423,7 +1423,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
1423
1423
/// May panic if the funding_txo is duplicative with some other channel (note that this should
1424
1424
/// be trivially prevented by using unique funding transaction keys per-channel).
1425
1425
pub fn funding_transaction_generated ( & self , temporary_channel_id : & [ u8 ; 32 ] , funding_txo : OutPoint ) {
1426
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1426
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1427
1427
1428
1428
let ( chan, msg) = {
1429
1429
let ( res, chan) = match self . channel_state . lock ( ) . unwrap ( ) . by_id . remove ( temporary_channel_id) {
@@ -1506,7 +1506,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
1506
1506
///
1507
1507
/// Panics if addresses is absurdly large (more than 500).
1508
1508
pub fn broadcast_node_announcement ( & self , rgb : [ u8 ; 3 ] , alias : [ u8 ; 32 ] , addresses : Vec < NetAddress > ) {
1509
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1509
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1510
1510
1511
1511
if addresses. len ( ) > 500 {
1512
1512
panic ! ( "More than half the message size was taken up by public addresses!" ) ;
@@ -1536,7 +1536,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
1536
1536
/// Should only really ever be called in response to a PendingHTLCsForwardable event.
1537
1537
/// Will likely generate further events.
1538
1538
pub fn process_pending_htlc_forwards ( & self ) {
1539
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1539
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1540
1540
1541
1541
let mut new_events = Vec :: new ( ) ;
1542
1542
let mut failed_forwards = Vec :: new ( ) ;
@@ -1789,7 +1789,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
1789
1789
///
1790
1790
/// This method handles all the details, and must be called roughly once per minute.
1791
1791
pub fn timer_chan_freshness_every_min ( & self ) {
1792
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1792
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1793
1793
let mut channel_state_lock = self . channel_state . lock ( ) . unwrap ( ) ;
1794
1794
let channel_state = & mut * channel_state_lock;
1795
1795
for ( _, chan) in channel_state. by_id . iter_mut ( ) {
@@ -1814,7 +1814,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
1814
1814
/// Returns false if no payment was found to fail backwards, true if the process of failing the
1815
1815
/// HTLC backwards has been started.
1816
1816
pub fn fail_htlc_backwards ( & self , payment_hash : & PaymentHash , payment_secret : & Option < PaymentSecret > ) -> bool {
1817
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1817
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1818
1818
1819
1819
let mut channel_state = Some ( self . channel_state . lock ( ) . unwrap ( ) ) ;
1820
1820
let removed_source = channel_state. as_mut ( ) . unwrap ( ) . claimable_htlcs . remove ( & ( * payment_hash, * payment_secret) ) ;
@@ -1993,7 +1993,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
1993
1993
pub fn claim_funds ( & self , payment_preimage : PaymentPreimage , payment_secret : & Option < PaymentSecret > , expected_amount : u64 ) -> bool {
1994
1994
let payment_hash = PaymentHash ( Sha256 :: hash ( & payment_preimage. 0 ) . into_inner ( ) ) ;
1995
1995
1996
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1996
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
1997
1997
1998
1998
let mut channel_state = Some ( self . channel_state . lock ( ) . unwrap ( ) ) ;
1999
1999
let removed_source = channel_state. as_mut ( ) . unwrap ( ) . claimable_htlcs . remove ( & ( payment_hash, * payment_secret) ) ;
@@ -2178,7 +2178,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
2178
2178
/// 4) once all remote copies are updated, you call this function with the update_id that
2179
2179
/// completed, and once it is the latest the Channel will be re-enabled.
2180
2180
pub fn channel_monitor_updated ( & self , funding_txo : & OutPoint , highest_applied_update_id : u64 ) {
2181
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
2181
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
2182
2182
2183
2183
let mut close_results = Vec :: new ( ) ;
2184
2184
let mut htlc_forwards = Vec :: new ( ) ;
@@ -2922,7 +2922,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
2922
2922
/// (C-not exported) Cause its doc(hidden) anyway
2923
2923
#[ doc( hidden) ]
2924
2924
pub fn update_fee ( & self , channel_id : [ u8 ; 32 ] , feerate_per_kw : u32 ) -> Result < ( ) , APIError > {
2925
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
2925
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
2926
2926
let counterparty_node_id;
2927
2927
let err: Result < ( ) , _ > = loop {
2928
2928
let mut channel_state_lock = self . channel_state . lock ( ) . unwrap ( ) ;
@@ -3062,7 +3062,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
3062
3062
pub fn block_connected ( & self , header : & BlockHeader , txdata : & TransactionData , height : u32 ) {
3063
3063
let header_hash = header. block_hash ( ) ;
3064
3064
log_trace ! ( self . logger, "Block {} at height {} connected" , header_hash, height) ;
3065
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3065
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3066
3066
let mut failed_channels = Vec :: new ( ) ;
3067
3067
let mut timed_out_htlcs = Vec :: new ( ) ;
3068
3068
{
@@ -3175,7 +3175,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
3175
3175
/// If necessary, the channel may be force-closed without letting the counterparty participate
3176
3176
/// in the shutdown.
3177
3177
pub fn block_disconnected ( & self , header : & BlockHeader ) {
3178
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3178
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3179
3179
let mut failed_channels = Vec :: new ( ) ;
3180
3180
{
3181
3181
let mut channel_lock = self . channel_state . lock ( ) . unwrap ( ) ;
@@ -3216,87 +3216,87 @@ impl<ChanSigner: ChannelKeys, M: Deref + Sync + Send, T: Deref + Sync + Send, K:
3216
3216
L :: Target : Logger ,
3217
3217
{
3218
3218
fn handle_open_channel ( & self , counterparty_node_id : & PublicKey , their_features : InitFeatures , msg : & msgs:: OpenChannel ) {
3219
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3219
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3220
3220
let _ = handle_error ! ( self , self . internal_open_channel( counterparty_node_id, their_features, msg) , * counterparty_node_id) ;
3221
3221
}
3222
3222
3223
3223
fn handle_accept_channel ( & self , counterparty_node_id : & PublicKey , their_features : InitFeatures , msg : & msgs:: AcceptChannel ) {
3224
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3224
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3225
3225
let _ = handle_error ! ( self , self . internal_accept_channel( counterparty_node_id, their_features, msg) , * counterparty_node_id) ;
3226
3226
}
3227
3227
3228
3228
fn handle_funding_created ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: FundingCreated ) {
3229
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3229
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3230
3230
let _ = handle_error ! ( self , self . internal_funding_created( counterparty_node_id, msg) , * counterparty_node_id) ;
3231
3231
}
3232
3232
3233
3233
fn handle_funding_signed ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: FundingSigned ) {
3234
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3234
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3235
3235
let _ = handle_error ! ( self , self . internal_funding_signed( counterparty_node_id, msg) , * counterparty_node_id) ;
3236
3236
}
3237
3237
3238
3238
fn handle_funding_locked ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: FundingLocked ) {
3239
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3239
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3240
3240
let _ = handle_error ! ( self , self . internal_funding_locked( counterparty_node_id, msg) , * counterparty_node_id) ;
3241
3241
}
3242
3242
3243
3243
fn handle_shutdown ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: Shutdown ) {
3244
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3244
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3245
3245
let _ = handle_error ! ( self , self . internal_shutdown( counterparty_node_id, msg) , * counterparty_node_id) ;
3246
3246
}
3247
3247
3248
3248
fn handle_closing_signed ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: ClosingSigned ) {
3249
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3249
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3250
3250
let _ = handle_error ! ( self , self . internal_closing_signed( counterparty_node_id, msg) , * counterparty_node_id) ;
3251
3251
}
3252
3252
3253
3253
fn handle_update_add_htlc ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: UpdateAddHTLC ) {
3254
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3254
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3255
3255
let _ = handle_error ! ( self , self . internal_update_add_htlc( counterparty_node_id, msg) , * counterparty_node_id) ;
3256
3256
}
3257
3257
3258
3258
fn handle_update_fulfill_htlc ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: UpdateFulfillHTLC ) {
3259
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3259
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3260
3260
let _ = handle_error ! ( self , self . internal_update_fulfill_htlc( counterparty_node_id, msg) , * counterparty_node_id) ;
3261
3261
}
3262
3262
3263
3263
fn handle_update_fail_htlc ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: UpdateFailHTLC ) {
3264
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3264
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3265
3265
let _ = handle_error ! ( self , self . internal_update_fail_htlc( counterparty_node_id, msg) , * counterparty_node_id) ;
3266
3266
}
3267
3267
3268
3268
fn handle_update_fail_malformed_htlc ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: UpdateFailMalformedHTLC ) {
3269
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3269
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3270
3270
let _ = handle_error ! ( self , self . internal_update_fail_malformed_htlc( counterparty_node_id, msg) , * counterparty_node_id) ;
3271
3271
}
3272
3272
3273
3273
fn handle_commitment_signed ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: CommitmentSigned ) {
3274
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3274
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3275
3275
let _ = handle_error ! ( self , self . internal_commitment_signed( counterparty_node_id, msg) , * counterparty_node_id) ;
3276
3276
}
3277
3277
3278
3278
fn handle_revoke_and_ack ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: RevokeAndACK ) {
3279
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3279
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3280
3280
let _ = handle_error ! ( self , self . internal_revoke_and_ack( counterparty_node_id, msg) , * counterparty_node_id) ;
3281
3281
}
3282
3282
3283
3283
fn handle_update_fee ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: UpdateFee ) {
3284
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3284
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3285
3285
let _ = handle_error ! ( self , self . internal_update_fee( counterparty_node_id, msg) , * counterparty_node_id) ;
3286
3286
}
3287
3287
3288
3288
fn handle_announcement_signatures ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: AnnouncementSignatures ) {
3289
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3289
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3290
3290
let _ = handle_error ! ( self , self . internal_announcement_signatures( counterparty_node_id, msg) , * counterparty_node_id) ;
3291
3291
}
3292
3292
3293
3293
fn handle_channel_reestablish ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: ChannelReestablish ) {
3294
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3294
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3295
3295
let _ = handle_error ! ( self , self . internal_channel_reestablish( counterparty_node_id, msg) , * counterparty_node_id) ;
3296
3296
}
3297
3297
3298
3298
fn peer_disconnected ( & self , counterparty_node_id : & PublicKey , no_connection_possible : bool ) {
3299
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3299
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3300
3300
let mut failed_channels = Vec :: new ( ) ;
3301
3301
let mut failed_payments = Vec :: new ( ) ;
3302
3302
let mut no_channels_remain = true ;
@@ -3387,7 +3387,7 @@ impl<ChanSigner: ChannelKeys, M: Deref + Sync + Send, T: Deref + Sync + Send, K:
3387
3387
fn peer_connected ( & self , counterparty_node_id : & PublicKey , init_msg : & msgs:: Init ) {
3388
3388
log_debug ! ( self . logger, "Generating channel_reestablish events for {}" , log_pubkey!( counterparty_node_id) ) ;
3389
3389
3390
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3390
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3391
3391
3392
3392
{
3393
3393
let mut peer_state_lock = self . per_peer_state . write ( ) . unwrap ( ) ;
@@ -3427,7 +3427,7 @@ impl<ChanSigner: ChannelKeys, M: Deref + Sync + Send, T: Deref + Sync + Send, K:
3427
3427
}
3428
3428
3429
3429
fn handle_error ( & self , counterparty_node_id : & PublicKey , msg : & msgs:: ErrorMessage ) {
3430
- let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3430
+ let _consistency_lock = self . total_consistency_lock . read ( ) . unwrap ( ) ;
3431
3431
3432
3432
if msg. channel_id == [ 0 ; 32 ] {
3433
3433
for chan in self . list_channels ( ) {
@@ -3659,7 +3659,7 @@ impl<ChanSigner: ChannelKeys + Writeable, M: Deref, T: Deref, K: Deref, F: Deref
3659
3659
L :: Target : Logger ,
3660
3660
{
3661
3661
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , :: std:: io:: Error > {
3662
- let _ = self . total_consistency_lock . write ( ) . unwrap ( ) ;
3662
+ let _consistency_lock = self . total_consistency_lock . write ( ) . unwrap ( ) ;
3663
3663
3664
3664
writer. write_all ( & [ SERIALIZATION_VERSION ; 1 ] ) ?;
3665
3665
writer. write_all ( & [ MIN_SERIALIZATION_VERSION ; 1 ] ) ?;
0 commit comments