@@ -46,7 +46,7 @@ use io;
46
46
use prelude:: * ;
47
47
use core:: { cmp, mem, fmt} ;
48
48
use core:: ops:: Deref ;
49
- #[ cfg( any( test, feature = "fuzztarget" , debug_assertions) ) ]
49
+ #[ cfg( any( test, fuzzing , debug_assertions) ) ]
50
50
use sync:: Mutex ;
51
51
use bitcoin:: hashes:: hex:: ToHex ;
52
52
@@ -670,9 +670,9 @@ pub(super) struct Channel<Signer: Sign> {
670
670
// `next_remote_commit_tx_fee_msat` properly predict what the next commitment transaction fee will
671
671
// be, by comparing the cached values to the fee of the tranaction generated by
672
672
// `build_commitment_transaction`.
673
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
673
+ #[ cfg( any( test, fuzzing ) ) ]
674
674
next_local_commitment_tx_fee_info_cached : Mutex < Option < CommitmentTxInfoCached > > ,
675
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
675
+ #[ cfg( any( test, fuzzing ) ) ]
676
676
next_remote_commitment_tx_fee_info_cached : Mutex < Option < CommitmentTxInfoCached > > ,
677
677
678
678
/// lnd has a long-standing bug where, upon reconnection, if the channel is not yet confirmed
@@ -684,7 +684,7 @@ pub(super) struct Channel<Signer: Sign> {
684
684
/// See-also <https://github.com/lightningnetwork/lnd/issues/4006>
685
685
pub workaround_lnd_bug_4006 : Option < msgs:: FundingLocked > ,
686
686
687
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
687
+ #[ cfg( any( test, fuzzing ) ) ]
688
688
// When we receive an HTLC fulfill on an outbound path, we may immediately fulfill the
689
689
// corresponding HTLC on the inbound path. If, then, the outbound path channel is
690
690
// disconnected and reconnected (before we've exchange commitment_signed and revoke_and_ack
@@ -697,7 +697,7 @@ pub(super) struct Channel<Signer: Sign> {
697
697
channel_type : ChannelTypeFeatures ,
698
698
}
699
699
700
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
700
+ #[ cfg( any( test, fuzzing ) ) ]
701
701
struct CommitmentTxInfoCached {
702
702
fee : u64 ,
703
703
total_pending_htlcs : usize ,
@@ -940,14 +940,14 @@ impl<Signer: Sign> Channel<Signer> {
940
940
941
941
announcement_sigs : None ,
942
942
943
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
943
+ #[ cfg( any( test, fuzzing ) ) ]
944
944
next_local_commitment_tx_fee_info_cached : Mutex :: new ( None ) ,
945
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
945
+ #[ cfg( any( test, fuzzing ) ) ]
946
946
next_remote_commitment_tx_fee_info_cached : Mutex :: new ( None ) ,
947
947
948
948
workaround_lnd_bug_4006 : None ,
949
949
950
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
950
+ #[ cfg( any( test, fuzzing ) ) ]
951
951
historical_inbound_htlc_fulfills : HashSet :: new ( ) ,
952
952
953
953
// We currently only actually support one channel type, so don't retry with new types
@@ -1245,14 +1245,14 @@ impl<Signer: Sign> Channel<Signer> {
1245
1245
1246
1246
announcement_sigs : None ,
1247
1247
1248
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
1248
+ #[ cfg( any( test, fuzzing ) ) ]
1249
1249
next_local_commitment_tx_fee_info_cached : Mutex :: new ( None ) ,
1250
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
1250
+ #[ cfg( any( test, fuzzing ) ) ]
1251
1251
next_remote_commitment_tx_fee_info_cached : Mutex :: new ( None ) ,
1252
1252
1253
1253
workaround_lnd_bug_4006 : None ,
1254
1254
1255
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
1255
+ #[ cfg( any( test, fuzzing ) ) ]
1256
1256
historical_inbound_htlc_fulfills : HashSet :: new ( ) ,
1257
1257
1258
1258
channel_type,
@@ -1650,7 +1650,7 @@ impl<Signer: Sign> Channel<Signer> {
1650
1650
}
1651
1651
}
1652
1652
if pending_idx == core:: usize:: MAX {
1653
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
1653
+ #[ cfg( any( test, fuzzing ) ) ]
1654
1654
// If we failed to find an HTLC to fulfill, make sure it was previously fulfilled and
1655
1655
// this is simply a duplicate claim, not previously failed and we lost funds.
1656
1656
debug_assert ! ( self . historical_inbound_htlc_fulfills. contains( & htlc_id_arg) ) ;
@@ -1676,7 +1676,7 @@ impl<Signer: Sign> Channel<Signer> {
1676
1676
if htlc_id_arg == htlc_id {
1677
1677
// Make sure we don't leave latest_monitor_update_id incremented here:
1678
1678
self . latest_monitor_update_id -= 1 ;
1679
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
1679
+ #[ cfg( any( test, fuzzing ) ) ]
1680
1680
debug_assert ! ( self . historical_inbound_htlc_fulfills. contains( & htlc_id_arg) ) ;
1681
1681
return UpdateFulfillFetch :: DuplicateClaim { } ;
1682
1682
}
@@ -1697,11 +1697,11 @@ impl<Signer: Sign> Channel<Signer> {
1697
1697
self . holding_cell_htlc_updates . push ( HTLCUpdateAwaitingACK :: ClaimHTLC {
1698
1698
payment_preimage : payment_preimage_arg, htlc_id : htlc_id_arg,
1699
1699
} ) ;
1700
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
1700
+ #[ cfg( any( test, fuzzing ) ) ]
1701
1701
self . historical_inbound_htlc_fulfills . insert ( htlc_id_arg) ;
1702
1702
return UpdateFulfillFetch :: NewClaim { monitor_update, htlc_value_msat, msg : None } ;
1703
1703
}
1704
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
1704
+ #[ cfg( any( test, fuzzing ) ) ]
1705
1705
self . historical_inbound_htlc_fulfills . insert ( htlc_id_arg) ;
1706
1706
1707
1707
{
@@ -1782,7 +1782,7 @@ impl<Signer: Sign> Channel<Signer> {
1782
1782
}
1783
1783
}
1784
1784
if pending_idx == core:: usize:: MAX {
1785
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
1785
+ #[ cfg( any( test, fuzzing ) ) ]
1786
1786
// If we failed to find an HTLC to fail, make sure it was previously fulfilled and this
1787
1787
// is simply a duplicate fail, not previously failed and we failed-back too early.
1788
1788
debug_assert ! ( self . historical_inbound_htlc_fulfills. contains( & htlc_id_arg) ) ;
@@ -1795,7 +1795,7 @@ impl<Signer: Sign> Channel<Signer> {
1795
1795
match pending_update {
1796
1796
& HTLCUpdateAwaitingACK :: ClaimHTLC { htlc_id, .. } => {
1797
1797
if htlc_id_arg == htlc_id {
1798
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
1798
+ #[ cfg( any( test, fuzzing ) ) ]
1799
1799
debug_assert ! ( self . historical_inbound_htlc_fulfills. contains( & htlc_id_arg) ) ;
1800
1800
return Ok ( None ) ;
1801
1801
}
@@ -2367,7 +2367,7 @@ impl<Signer: Sign> Channel<Signer> {
2367
2367
2368
2368
let num_htlcs = included_htlcs + addl_htlcs;
2369
2369
let res = Self :: commit_tx_fee_msat ( self . feerate_per_kw , num_htlcs, self . opt_anchors ( ) ) ;
2370
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
2370
+ #[ cfg( any( test, fuzzing ) ) ]
2371
2371
{
2372
2372
let mut fee = res;
2373
2373
if fee_spike_buffer_htlc. is_some ( ) {
@@ -2445,7 +2445,7 @@ impl<Signer: Sign> Channel<Signer> {
2445
2445
2446
2446
let num_htlcs = included_htlcs + addl_htlcs;
2447
2447
let res = Self :: commit_tx_fee_msat ( self . feerate_per_kw , num_htlcs, self . opt_anchors ( ) ) ;
2448
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
2448
+ #[ cfg( any( test, fuzzing ) ) ]
2449
2449
{
2450
2450
let mut fee = res;
2451
2451
if fee_spike_buffer_htlc. is_some ( ) {
@@ -2728,7 +2728,7 @@ impl<Signer: Sign> Channel<Signer> {
2728
2728
return Err ( ( None , ChannelError :: Close ( "Funding remote cannot afford proposed new fee" . to_owned ( ) ) ) ) ;
2729
2729
}
2730
2730
}
2731
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
2731
+ #[ cfg( any( test, fuzzing ) ) ]
2732
2732
{
2733
2733
if self . is_outbound ( ) {
2734
2734
let projected_commit_tx_info = self . next_local_commitment_tx_fee_info_cached . lock ( ) . unwrap ( ) . take ( ) ;
@@ -3035,7 +3035,7 @@ impl<Signer: Sign> Channel<Signer> {
3035
3035
return Err ( ChannelError :: Close ( "Received an unexpected revoke_and_ack" . to_owned ( ) ) ) ;
3036
3036
}
3037
3037
3038
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
3038
+ #[ cfg( any( test, fuzzing ) ) ]
3039
3039
{
3040
3040
* self . next_local_commitment_tx_fee_info_cached . lock ( ) . unwrap ( ) = None ;
3041
3041
* self . next_remote_commitment_tx_fee_info_cached . lock ( ) . unwrap ( ) = None ;
@@ -4466,9 +4466,9 @@ impl<Signer: Sign> Channel<Signer> {
4466
4466
// If we generated the funding transaction and it doesn't match what it
4467
4467
// should, the client is really broken and we should just panic and
4468
4468
// tell them off. That said, because hash collisions happen with high
4469
- // probability in fuzztarget mode, if we're fuzzing we just close the
4469
+ // probability in fuzzing mode, if we're fuzzing we just close the
4470
4470
// channel and move on.
4471
- #[ cfg( not( feature = "fuzztarget" ) ) ]
4471
+ #[ cfg( not( fuzzing ) ) ]
4472
4472
panic ! ( "Client called ChannelManager::funding_transaction_generated with bogus transaction!" ) ;
4473
4473
}
4474
4474
self . update_time_counter += 1 ;
@@ -4480,7 +4480,7 @@ impl<Signer: Sign> Channel<Signer> {
4480
4480
if input. witness . is_empty ( ) {
4481
4481
// We generated a malleable funding transaction, implying we've
4482
4482
// just exposed ourselves to funds loss to our counterparty.
4483
- #[ cfg( not( feature = "fuzztarget" ) ) ]
4483
+ #[ cfg( not( fuzzing ) ) ]
4484
4484
panic ! ( "Client called ChannelManager::funding_transaction_generated with bogus transaction!" ) ;
4485
4485
}
4486
4486
}
@@ -4937,9 +4937,9 @@ impl<Signer: Sign> Channel<Signer> {
4937
4937
// Prior to static_remotekey, my_current_per_commitment_point was critical to claiming
4938
4938
// current to_remote balances. However, it no longer has any use, and thus is now simply
4939
4939
// set to a dummy (but valid, as required by the spec) public key.
4940
- // fuzztarget mode marks a subset of pubkeys as invalid so that we can hit "invalid pubkey"
4940
+ // fuzzing mode marks a subset of pubkeys as invalid so that we can hit "invalid pubkey"
4941
4941
// branches, but we unwrap it below, so we arbitrarily select a dummy pubkey which is both
4942
- // valid, and valid in fuzztarget mode's arbitrary validity criteria:
4942
+ // valid, and valid in fuzzing mode's arbitrary validity criteria:
4943
4943
let mut pk = [ 2 ; 33 ] ; pk[ 1 ] = 0xff ;
4944
4944
let dummy_pubkey = PublicKey :: from_slice ( & pk) . unwrap ( ) ;
4945
4945
let data_loss_protect = if self . cur_counterparty_commitment_transaction_number + 1 < INITIAL_COMMITMENT_NUMBER {
@@ -5225,7 +5225,7 @@ impl<Signer: Sign> Channel<Signer> {
5225
5225
let counterparty_commitment_txid = commitment_stats. tx . trust ( ) . txid ( ) ;
5226
5226
let ( signature, htlc_signatures) ;
5227
5227
5228
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
5228
+ #[ cfg( any( test, fuzzing ) ) ]
5229
5229
{
5230
5230
if !self . is_outbound ( ) {
5231
5231
let projected_commit_tx_info = self . next_remote_commitment_tx_fee_info_cached . lock ( ) . unwrap ( ) . take ( ) ;
@@ -5711,9 +5711,9 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
5711
5711
5712
5712
self . channel_update_status . write ( writer) ?;
5713
5713
5714
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
5714
+ #[ cfg( any( test, fuzzing ) ) ]
5715
5715
( self . historical_inbound_htlc_fulfills . len ( ) as u64 ) . write ( writer) ?;
5716
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
5716
+ #[ cfg( any( test, fuzzing ) ) ]
5717
5717
for htlc in self . historical_inbound_htlc_fulfills . iter ( ) {
5718
5718
htlc. write ( writer) ?;
5719
5719
}
@@ -5975,9 +5975,9 @@ impl<'a, Signer: Sign, K: Deref> ReadableArgs<(&'a K, u32)> for Channel<Signer>
5975
5975
5976
5976
let channel_update_status = Readable :: read ( reader) ?;
5977
5977
5978
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
5978
+ #[ cfg( any( test, fuzzing ) ) ]
5979
5979
let mut historical_inbound_htlc_fulfills = HashSet :: new ( ) ;
5980
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
5980
+ #[ cfg( any( test, fuzzing ) ) ]
5981
5981
{
5982
5982
let htlc_fulfills_len: u64 = Readable :: read ( reader) ?;
5983
5983
for _ in 0 ..htlc_fulfills_len {
@@ -6151,14 +6151,14 @@ impl<'a, Signer: Sign, K: Deref> ReadableArgs<(&'a K, u32)> for Channel<Signer>
6151
6151
6152
6152
announcement_sigs,
6153
6153
6154
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
6154
+ #[ cfg( any( test, fuzzing ) ) ]
6155
6155
next_local_commitment_tx_fee_info_cached : Mutex :: new ( None ) ,
6156
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
6156
+ #[ cfg( any( test, fuzzing ) ) ]
6157
6157
next_remote_commitment_tx_fee_info_cached : Mutex :: new ( None ) ,
6158
6158
6159
6159
workaround_lnd_bug_4006 : None ,
6160
6160
6161
- #[ cfg( any( test, feature = "fuzztarget" ) ) ]
6161
+ #[ cfg( any( test, fuzzing ) ) ]
6162
6162
historical_inbound_htlc_fulfills,
6163
6163
6164
6164
channel_type : channel_type. unwrap ( ) ,
0 commit comments