@@ -86,7 +86,7 @@ use bitcoin::secp256k1::{self, Message, PublicKey, Scalar, Secp256k1, SecretKey}
86
86
use lightning:: util:: dyn_signer:: DynSigner ;
87
87
88
88
use std:: cell:: RefCell ;
89
- use std:: cmp:: { self , Ordering } ;
89
+ use std:: cmp;
90
90
use std:: mem;
91
91
use std:: sync:: atomic;
92
92
use std:: sync:: { Arc , Mutex } ;
@@ -1309,28 +1309,6 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1309
1309
// deduplicate the calls here.
1310
1310
let mut claim_set = new_hash_map( ) ;
1311
1311
let mut events = nodes[ $node] . get_and_clear_pending_events( ) ;
1312
- // Sort events so that PendingHTLCsForwardable get processed last. This avoids a
1313
- // case where we first process a PendingHTLCsForwardable, then claim/fail on a
1314
- // PaymentClaimable, claiming/failing two HTLCs, but leaving a just-generated
1315
- // PaymentClaimable event for the second HTLC in our pending_events (and breaking
1316
- // our claim_set deduplication).
1317
- events. sort_by( |a, b| {
1318
- if let events:: Event :: PaymentClaimable { .. } = a {
1319
- if let events:: Event :: PendingHTLCsForwardable { .. } = b {
1320
- Ordering :: Less
1321
- } else {
1322
- Ordering :: Equal
1323
- }
1324
- } else if let events:: Event :: PendingHTLCsForwardable { .. } = a {
1325
- if let events:: Event :: PaymentClaimable { .. } = b {
1326
- Ordering :: Greater
1327
- } else {
1328
- Ordering :: Equal
1329
- }
1330
- } else {
1331
- Ordering :: Equal
1332
- }
1333
- } ) ;
1334
1312
let had_events = !events. is_empty( ) ;
1335
1313
for event in events. drain( ..) {
1336
1314
match event {
@@ -1357,9 +1335,6 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1357
1335
} ,
1358
1336
events:: Event :: PaymentForwarded { .. } if $node == 1 => { } ,
1359
1337
events:: Event :: ChannelReady { .. } => { } ,
1360
- events:: Event :: PendingHTLCsForwardable { .. } => {
1361
- nodes[ $node] . process_pending_htlc_forwards( ) ;
1362
- } ,
1363
1338
events:: Event :: HTLCHandlingFailed { .. } => { } ,
1364
1339
_ => {
1365
1340
if out. may_fail. load( atomic:: Ordering :: Acquire ) {
@@ -1370,6 +1345,9 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1370
1345
} ,
1371
1346
}
1372
1347
}
1348
+ while nodes[ $node] . needs_pending_htlc_processing( ) {
1349
+ nodes[ $node] . process_pending_htlc_forwards( ) ;
1350
+ }
1373
1351
had_events
1374
1352
} } ;
1375
1353
}
@@ -1811,8 +1789,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1811
1789
last_pass_no_updates = false ;
1812
1790
continue ;
1813
1791
}
1814
- // ...making sure any pending PendingHTLCsForwardable events are handled and
1815
- // payments claimed.
1792
+ // ...making sure any payments are claimed.
1816
1793
if process_events!( 0 , false ) {
1817
1794
last_pass_no_updates = false ;
1818
1795
continue ;
0 commit comments