@@ -346,12 +346,6 @@ fn sorted_vec<T: Ord>(mut v: Vec<T>) -> Vec<T> {
346
346
v
347
347
}
348
348
349
- fn verify_claimable_balances ( mut balances_1 : Vec < Balance > , mut balances_2 : Vec < Balance > ) {
350
- balances_1. sort ( ) ;
351
- balances_2. sort ( ) ;
352
- assert_eq ! ( balances_1, balances_2) ;
353
- }
354
-
355
349
/// Asserts that `a` and `b` are close, but maybe off by up to 5.
356
350
/// This is useful when checking fees and weights on transactions as things may vary by a few based
357
351
/// on signature size and signature size estimation being non-exact.
@@ -1356,31 +1350,33 @@ fn do_test_revoked_counterparty_commitment_balances(anchors: bool, confirm_htlc_
1356
1350
1357
1351
// Prior to channel closure, B considers the preimage HTLC as its own, and otherwise only
1358
1352
// lists the two on-chain timeout-able HTLCs as claimable balances.
1359
- verify_claimable_balances (
1360
- vec ! [ Balance :: ClaimableOnChannelClose {
1361
- amount_satoshis: 100_000 - 5_000 - 4_000 - 3 - 2_000 + 3_000 - 1 /* rounded up msat parts of HTLCs */ ,
1362
- transaction_fee_satoshis: 0 ,
1363
- outbound_payment_htlc_rounded_msat: 3200 ,
1364
- outbound_forwarded_htlc_rounded_msat: 0 ,
1365
- inbound_claiming_htlc_rounded_msat: 100 ,
1366
- inbound_htlc_rounded_msat: 0 ,
1367
- } , Balance :: MaybeTimeoutClaimableHTLC {
1368
- amount_satoshis: 2_000 ,
1369
- claimable_height: missing_htlc_cltv_timeout,
1370
- payment_hash: missing_htlc_payment_hash,
1371
- outbound_payment: true ,
1372
- } , Balance :: MaybeTimeoutClaimableHTLC {
1373
- amount_satoshis: 4_000 ,
1374
- claimable_height: htlc_cltv_timeout,
1375
- payment_hash: timeout_payment_hash,
1376
- outbound_payment: true ,
1377
- } , Balance :: MaybeTimeoutClaimableHTLC {
1378
- amount_satoshis: 5_000 ,
1379
- claimable_height: live_htlc_cltv_timeout,
1380
- payment_hash: live_payment_hash,
1381
- outbound_payment: true ,
1382
- } ] ,
1383
- nodes[ 1 ] . chain_monitor . chain_monitor . get_monitor ( funding_outpoint) . unwrap ( ) . get_claimable_balances ( ) ,
1353
+ assert_eq ! (
1354
+ sorted_vec( vec![
1355
+ Balance :: ClaimableOnChannelClose {
1356
+ amount_satoshis: 100_000 - 5_000 - 4_000 - 3 - 2_000 + 3_000 - 1 /* rounded up msat parts of HTLCs */ ,
1357
+ transaction_fee_satoshis: 0 ,
1358
+ outbound_payment_htlc_rounded_msat: 3200 ,
1359
+ outbound_forwarded_htlc_rounded_msat: 0 ,
1360
+ inbound_claiming_htlc_rounded_msat: 100 ,
1361
+ inbound_htlc_rounded_msat: 0 ,
1362
+ } , Balance :: MaybeTimeoutClaimableHTLC {
1363
+ amount_satoshis: 2_000 ,
1364
+ claimable_height: missing_htlc_cltv_timeout,
1365
+ payment_hash: missing_htlc_payment_hash,
1366
+ outbound_payment: true ,
1367
+ } , Balance :: MaybeTimeoutClaimableHTLC {
1368
+ amount_satoshis: 4_000 ,
1369
+ claimable_height: htlc_cltv_timeout,
1370
+ payment_hash: timeout_payment_hash,
1371
+ outbound_payment: true ,
1372
+ } , Balance :: MaybeTimeoutClaimableHTLC {
1373
+ amount_satoshis: 5_000 ,
1374
+ claimable_height: live_htlc_cltv_timeout,
1375
+ payment_hash: live_payment_hash,
1376
+ outbound_payment: true ,
1377
+ } ,
1378
+ ] ) ,
1379
+ sorted_vec( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ,
1384
1380
) ;
1385
1381
1386
1382
mine_transaction ( & nodes[ 1 ] , & as_revoked_txn[ 0 ] ) ;
@@ -1427,15 +1423,15 @@ fn do_test_revoked_counterparty_commitment_balances(anchors: bool, confirm_htlc_
1427
1423
1428
1424
// Once the channel has been closed by A, B now considers all of the commitment transactions'
1429
1425
// outputs as `CounterpartyRevokedOutputClaimable`.
1430
- verify_claimable_balances (
1431
- vec ! [
1426
+ assert_eq ! (
1427
+ sorted_vec ( vec![
1432
1428
to_remote_balance. clone( ) ,
1433
1429
to_self_unclaimed_balance. clone( ) ,
1434
1430
htlc_unclaimed_balance( 3_000 ) ,
1435
1431
htlc_unclaimed_balance( 4_000 ) ,
1436
1432
htlc_unclaimed_balance( 5_000 ) ,
1437
- ] ,
1438
- nodes[ 1 ] . chain_monitor . chain_monitor . get_monitor ( funding_outpoint) . unwrap ( ) . get_claimable_balances ( ) ,
1433
+ ] ) ,
1434
+ sorted_vec ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ,
1439
1435
) ;
1440
1436
1441
1437
if confirm_htlc_spend_first {
@@ -1461,24 +1457,24 @@ fn do_test_revoked_counterparty_commitment_balances(anchors: bool, confirm_htlc_
1461
1457
} ;
1462
1458
1463
1459
if confirm_htlc_spend_first {
1464
- verify_claimable_balances (
1465
- vec ! [
1460
+ assert_eq ! (
1461
+ sorted_vec ( vec![
1466
1462
to_remote_balance. clone( ) ,
1467
1463
pinnable_claimed_balance. clone( ) ,
1468
1464
to_self_unclaimed_balance. clone( ) ,
1469
- ] ,
1470
- nodes[ 1 ] . chain_monitor . chain_monitor . get_monitor ( funding_outpoint) . unwrap ( ) . get_claimable_balances ( ) ,
1465
+ ] ) ,
1466
+ sorted_vec ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ,
1471
1467
) ;
1472
1468
} else {
1473
- verify_claimable_balances (
1474
- vec ! [
1469
+ assert_eq ! (
1470
+ sorted_vec ( vec![
1475
1471
to_remote_balance. clone( ) ,
1476
1472
unpinnable_claimed_balance. clone( ) ,
1477
1473
htlc_unclaimed_balance( 3_000 ) ,
1478
1474
htlc_unclaimed_balance( 4_000 ) ,
1479
1475
htlc_unclaimed_balance( 5_000 ) ,
1480
- ] ,
1481
- nodes[ 1 ] . chain_monitor . chain_monitor . get_monitor ( funding_outpoint) . unwrap ( ) . get_claimable_balances ( ) ,
1476
+ ] ) ,
1477
+ sorted_vec ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ,
1482
1478
) ;
1483
1479
}
1484
1480
@@ -1487,13 +1483,13 @@ fn do_test_revoked_counterparty_commitment_balances(anchors: bool, confirm_htlc_
1487
1483
} else {
1488
1484
mine_transaction ( & nodes[ 1 ] , & claim_txn[ 0 ] ) ;
1489
1485
}
1490
- verify_claimable_balances (
1491
- vec ! [
1486
+ assert_eq ! (
1487
+ sorted_vec ( vec![
1492
1488
to_remote_balance. clone( ) ,
1493
1489
pinnable_claimed_balance. clone( ) ,
1494
1490
unpinnable_claimed_balance. clone( ) ,
1495
- ] ,
1496
- nodes[ 1 ] . chain_monitor . chain_monitor . get_monitor ( funding_outpoint) . unwrap ( ) . get_claimable_balances ( ) ,
1491
+ ] ) ,
1492
+ sorted_vec ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ,
1497
1493
) ;
1498
1494
1499
1495
connect_blocks ( & nodes[ 1 ] , 3 ) ;
0 commit comments