@@ -397,10 +397,10 @@ fn do_test_claim_value_force_close(anchors: bool, prev_commitment_tx: bool) {
397397 assert_eq ! ( ChannelId :: v1_from_funding_outpoint( funding_outpoint) , chan_id) ;
398398
399399 // This HTLC is immediately claimed, giving node B the preimage
400- let ( payment_preimage, payment_hash, ..) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 3_000_000 ) ;
400+ let ( payment_preimage, payment_hash, ..) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 3_000_100 ) ;
401401 // This HTLC is allowed to time out, letting A claim it. However, in order to test claimable
402402 // balances more fully we also give B the preimage for this HTLC.
403- let ( timeout_payment_preimage, timeout_payment_hash, ..) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 4_000_000 ) ;
403+ let ( timeout_payment_preimage, timeout_payment_hash, ..) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 4_000_200 ) ;
404404 // This HTLC will be dust, and not be claimable at all:
405405 let ( dust_payment_preimage, dust_payment_hash, ..) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 3_000 ) ;
406406
@@ -451,9 +451,9 @@ fn do_test_claim_value_force_close(anchors: bool, prev_commitment_tx: bool) {
451451 ( chan_utils:: commitment_tx_base_weight ( & channel_type_features) + 2 * chan_utils:: COMMITMENT_TX_WEIGHT_PER_HTLC ) / 1000 ;
452452 let anchor_outputs_value = if anchors { 2 * channel:: ANCHOR_OUTPUT_VALUE_SATOSHI } else { 0 } ;
453453 assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableOnChannelClose {
454- amount_satoshis: 1_000_000 - 3_000 - 4_000 - 1_000 - 3 - commitment_tx_fee - anchor_outputs_value,
454+ amount_satoshis: 1_000_000 - 3_000 - 4_000 - 1_000 - 3 - commitment_tx_fee - anchor_outputs_value - 1 /* msat amount that is burned to fees */ ,
455455 transaction_fee_satoshis: commitment_tx_fee,
456- outbound_payment_htlc_rounded_msat: 3000 ,
456+ outbound_payment_htlc_rounded_msat: 3300 ,
457457 outbound_forwarded_htlc_rounded_msat: 0 ,
458458 inbound_claiming_htlc_rounded_msat: 0 ,
459459 inbound_htlc_rounded_msat: 0 ,
@@ -465,13 +465,13 @@ fn do_test_claim_value_force_close(anchors: bool, prev_commitment_tx: bool) {
465465 outbound_payment_htlc_rounded_msat: 0 ,
466466 outbound_forwarded_htlc_rounded_msat: 0 ,
467467 inbound_claiming_htlc_rounded_msat: 0 ,
468- inbound_htlc_rounded_msat: 3000 ,
468+ inbound_htlc_rounded_msat: 3300 ,
469469 } , received_htlc_balance. clone( ) , received_htlc_timeout_balance. clone( ) ] ) ,
470470 sorted_vec( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
471471
472472 nodes[ 1 ] . node . claim_funds ( payment_preimage) ;
473473 check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
474- expect_payment_claimed ! ( nodes[ 1 ] , payment_hash, 3_000_000 ) ;
474+ expect_payment_claimed ! ( nodes[ 1 ] , payment_hash, 3_000_100 ) ;
475475
476476 let b_htlc_msgs = get_htlc_update_msgs ! ( & nodes[ 1 ] , nodes[ 0 ] . node. get_our_node_id( ) ) ;
477477 // We claim the dust payment here as well, but it won't impact our claimable balances as its
@@ -482,7 +482,7 @@ fn do_test_claim_value_force_close(anchors: bool, prev_commitment_tx: bool) {
482482
483483 nodes[ 1 ] . node . claim_funds ( timeout_payment_preimage) ;
484484 check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
485- expect_payment_claimed ! ( nodes[ 1 ] , timeout_payment_hash, 4_000_000 ) ;
485+ expect_payment_claimed ! ( nodes[ 1 ] , timeout_payment_hash, 4_000_200 ) ;
486486
487487 if prev_commitment_tx {
488488 // To build a previous commitment transaction, deliver one round of commitment messages.
@@ -511,9 +511,11 @@ fn do_test_claim_value_force_close(anchors: bool, prev_commitment_tx: bool) {
511511 1_000 - // The push_msat value in satoshis
512512 3 - // The dust HTLC value in satoshis
513513 commitment_tx_fee - // The commitment transaction fee with two HTLC outputs
514- anchor_outputs_value, // The anchor outputs value in satoshis
514+ anchor_outputs_value - // The anchor outputs value in satoshis
515+ 1 , // The rounded up msat part of the one HTLC
515516 transaction_fee_satoshis: commitment_tx_fee,
516- outbound_payment_htlc_rounded_msat: 3000 ,
517+ outbound_payment_htlc_rounded_msat: 3000 + if prev_commitment_tx {
518+ 200 /* 1 to-be-failed HTLC */ } else { 300 /* 2 HTLCs */ } ,
517519 outbound_forwarded_htlc_rounded_msat: 0 ,
518520 inbound_claiming_htlc_rounded_msat: 0 ,
519521 inbound_htlc_rounded_msat: 0 ,
@@ -528,7 +530,8 @@ fn do_test_claim_value_force_close(anchors: bool, prev_commitment_tx: bool) {
528530 transaction_fee_satoshis: 0 ,
529531 outbound_payment_htlc_rounded_msat: 0 ,
530532 outbound_forwarded_htlc_rounded_msat: 0 ,
531- inbound_claiming_htlc_rounded_msat: 3000 ,
533+ inbound_claiming_htlc_rounded_msat: 3000 + if prev_commitment_tx {
534+ 200 /* 1 HTLC */ } else { 300 /* 2 HTLCs */ } ,
532535 inbound_htlc_rounded_msat: 0 ,
533536 } ] ,
534537 nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ;
@@ -593,7 +596,14 @@ fn do_test_claim_value_force_close(anchors: bool, prev_commitment_tx: bool) {
593596 let commitment_tx_fee = chan_feerate as u64 *
594597 ( chan_utils:: commitment_tx_base_weight ( & channel_type_features) + 2 * chan_utils:: COMMITMENT_TX_WEIGHT_PER_HTLC ) / 1000 ;
595598 assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableAwaitingConfirmations {
596- amount_satoshis: 1_000_000 - 3_000 - 4_000 - 1_000 - 3 - commitment_tx_fee - anchor_outputs_value,
599+ amount_satoshis: 1_000_000 - // Channel funding value in satoshis
600+ 4_000 - // The to-be-failed HTLC value in satoshis
601+ 3_000 - // The claimed HTLC value in satoshis
602+ 1_000 - // The push_msat value in satoshis
603+ 3 - // The dust HTLC value in satoshis
604+ commitment_tx_fee - // The commitment transaction fee with two HTLC outputs
605+ anchor_outputs_value - // The anchor outputs value in satoshis
606+ 1 , // The rounded up msat parts of HTLCs
597607 confirmation_height: nodes[ 0 ] . best_block_info( ) . 1 + ANTI_REORG_DELAY - 1 ,
598608 } , sent_htlc_balance. clone( ) , sent_htlc_timeout_balance. clone( ) ] ) ,
599609 sorted_vec( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
@@ -1240,8 +1250,8 @@ fn do_test_revoked_counterparty_commitment_balances(anchors: bool, confirm_htlc_
12401250 // are all currently claimed in separate transactions, which helps us test as we can claim
12411251 // HTLCs individually.
12421252
1243- let ( claimed_payment_preimage, claimed_payment_hash, ..) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 3_000_000 ) ;
1244- let timeout_payment_hash = route_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , 4_000_000 ) . 1 ;
1253+ let ( claimed_payment_preimage, claimed_payment_hash, ..) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 3_000_100 ) ;
1254+ let timeout_payment_hash = route_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , 4_000_200 ) . 1 ;
12451255 let dust_payment_hash = route_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , 3_000 ) . 1 ;
12461256
12471257 let htlc_cltv_timeout = nodes[ 0 ] . best_block_info ( ) . 1 + TEST_FINAL_CLTV + 1 ; // Note ChannelManager adds one to CLTV timeouts for safety
@@ -1262,7 +1272,7 @@ fn do_test_revoked_counterparty_commitment_balances(anchors: bool, confirm_htlc_
12621272 let missing_htlc_payment_hash = route_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , 2_000_000 ) . 1 ;
12631273
12641274 nodes[ 1 ] . node . claim_funds ( claimed_payment_preimage) ;
1265- expect_payment_claimed ! ( nodes[ 1 ] , claimed_payment_hash, 3_000_000 ) ;
1275+ expect_payment_claimed ! ( nodes[ 1 ] , claimed_payment_hash, 3_000_100 ) ;
12661276 check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
12671277 let _b_htlc_msgs = get_htlc_update_msgs ! ( & nodes[ 1 ] , nodes[ 0 ] . node. get_our_node_id( ) ) ;
12681278
@@ -1304,11 +1314,11 @@ fn do_test_revoked_counterparty_commitment_balances(anchors: bool, confirm_htlc_
13041314 // Prior to channel closure, B considers the preimage HTLC as its own, and otherwise only
13051315 // lists the two on-chain timeout-able HTLCs as claimable balances.
13061316 assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableOnChannelClose {
1307- amount_satoshis: 100_000 - 5_000 - 4_000 - 3 - 2_000 + 3_000 ,
1317+ amount_satoshis: 100_000 - 5_000 - 4_000 - 3 - 2_000 + 3_000 - 1 /* rounded up msat parts of HTLCs */ ,
13081318 transaction_fee_satoshis: 0 ,
1309- outbound_payment_htlc_rounded_msat: 3000 ,
1319+ outbound_payment_htlc_rounded_msat: 3200 ,
13101320 outbound_forwarded_htlc_rounded_msat: 0 ,
1311- inbound_claiming_htlc_rounded_msat: 0 ,
1321+ inbound_claiming_htlc_rounded_msat: 100 ,
13121322 inbound_htlc_rounded_msat: 0 ,
13131323 } , Balance :: MaybeTimeoutClaimableHTLC {
13141324 amount_satoshis: 2_000 ,
@@ -1358,7 +1368,7 @@ fn do_test_revoked_counterparty_commitment_balances(anchors: bool, confirm_htlc_
13581368 // claim balances separated out.
13591369 let expected_balance = vec ! [ Balance :: ClaimableAwaitingConfirmations {
13601370 // to_remote output in A's revoked commitment
1361- amount_satoshis: 100_000 - 5_000 - 4_000 - 3 ,
1371+ amount_satoshis: 100_000 - 5_000 - 4_000 - 3 - 1 /* rounded up msat parts of HTLCs */ ,
13621372 confirmation_height: nodes[ 1 ] . best_block_info( ) . 1 + 5 ,
13631373 } , Balance :: CounterpartyRevokedOutputClaimable {
13641374 amount_satoshis: 3_000 ,
@@ -1367,7 +1377,7 @@ fn do_test_revoked_counterparty_commitment_balances(anchors: bool, confirm_htlc_
13671377 } ] ;
13681378
13691379 let to_self_unclaimed_balance = Balance :: CounterpartyRevokedOutputClaimable {
1370- amount_satoshis : 1_000_000 - 100_000 - 3_000 - commitment_tx_fee - anchor_outputs_value,
1380+ amount_satoshis : 1_000_000 - 100_000 - 3_000 - commitment_tx_fee - anchor_outputs_value - 1 /* rounded up msat parts of HTLCs */ ,
13711381 } ;
13721382 let to_self_claimed_avail_height;
13731383 let largest_htlc_unclaimed_balance = Balance :: CounterpartyRevokedOutputClaimable {
@@ -1396,7 +1406,7 @@ fn do_test_revoked_counterparty_commitment_balances(anchors: bool, confirm_htlc_
13961406 confirmation_height : largest_htlc_claimed_avail_height,
13971407 } ;
13981408 let to_self_claimed_balance = Balance :: ClaimableAwaitingConfirmations {
1399- amount_satoshis : 1_000_000 - 100_000 - 3_000 - commitment_tx_fee - anchor_outputs_value - to_self_claim_fee,
1409+ amount_satoshis : 1_000_000 - 100_000 - 3_000 - commitment_tx_fee - anchor_outputs_value - to_self_claim_fee - 1 /* rounded up msat parts of HTLCs */ ,
14001410 confirmation_height : to_self_claimed_avail_height,
14011411 } ;
14021412
@@ -1423,10 +1433,10 @@ fn do_test_revoked_counterparty_commitment_balances(anchors: bool, confirm_htlc_
14231433
14241434 assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableAwaitingConfirmations {
14251435 // to_remote output in A's revoked commitment
1426- amount_satoshis: 100_000 - 5_000 - 4_000 - 3 ,
1436+ amount_satoshis: 100_000 - 5_000 - 4_000 - 3 - 1 /* rounded up msat parts of HTLCs */ ,
14271437 confirmation_height: nodes[ 1 ] . best_block_info( ) . 1 + 1 ,
14281438 } , Balance :: ClaimableAwaitingConfirmations {
1429- amount_satoshis: 1_000_000 - 100_000 - 3_000 - commitment_tx_fee - anchor_outputs_value - to_self_claim_fee,
1439+ amount_satoshis: 1_000_000 - 100_000 - 3_000 - commitment_tx_fee - anchor_outputs_value - to_self_claim_fee - 1 /* rounded up msat parts of HTLCs */ ,
14301440 confirmation_height: to_self_claimed_avail_height,
14311441 } , Balance :: ClaimableAwaitingConfirmations {
14321442 amount_satoshis: 3_000 - outbound_htlc_claim_fee,
@@ -1517,7 +1527,7 @@ fn do_test_revoked_counterparty_htlc_tx_balances(anchors: bool) {
15171527 let funding_outpoint = OutPoint { txid : funding_tx. txid ( ) , index : 0 } ;
15181528 assert_eq ! ( ChannelId :: v1_from_funding_outpoint( funding_outpoint) , chan_id) ;
15191529
1520- let payment_preimage = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 3_000_000 ) . 0 ;
1530+ let payment_preimage = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 3_000_100 ) . 0 ;
15211531 let failed_payment_hash = route_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , 1_000_000 ) . 1 ;
15221532 let revoked_local_txn = get_local_commitment_txn ! ( nodes[ 1 ] , chan_id) ;
15231533 assert_eq ! ( revoked_local_txn[ 0 ] . input. len( ) , 1 ) ;
@@ -1612,7 +1622,7 @@ fn do_test_revoked_counterparty_htlc_tx_balances(anchors: bool) {
16121622 let anchor_outputs_value = if anchors { channel:: ANCHOR_OUTPUT_VALUE_SATOSHI * 2 } else { 0 } ;
16131623 let as_balances = sorted_vec ( vec ! [ Balance :: ClaimableAwaitingConfirmations {
16141624 // to_remote output in B's revoked commitment
1615- amount_satoshis: 1_000_000 - 12_000 - 3_000 - commitment_tx_fee - anchor_outputs_value,
1625+ amount_satoshis: 1_000_000 - 12_000 - 3_000 - commitment_tx_fee - anchor_outputs_value - 1 /* The rounded up msat part of the one HTLC */ ,
16161626 confirmation_height: to_remote_conf_height,
16171627 } , Balance :: CounterpartyRevokedOutputClaimable {
16181628 // to_self output in B's revoked commitment
@@ -1657,7 +1667,7 @@ fn do_test_revoked_counterparty_htlc_tx_balances(anchors: bool) {
16571667 mine_transaction ( & nodes[ 0 ] , & as_htlc_claim_tx[ 0 ] ) ;
16581668 assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableAwaitingConfirmations {
16591669 // to_remote output in B's revoked commitment
1660- amount_satoshis: 1_000_000 - 12_000 - 3_000 - commitment_tx_fee - anchor_outputs_value,
1670+ amount_satoshis: 1_000_000 - 12_000 - 3_000 - commitment_tx_fee - anchor_outputs_value - 1 /* rounded up msat parts of HTLCs */ ,
16611671 confirmation_height: to_remote_conf_height,
16621672 } , Balance :: CounterpartyRevokedOutputClaimable {
16631673 // to_self output in B's revoked commitment
@@ -1823,7 +1833,7 @@ fn do_test_revoked_counterparty_aggregated_claims(anchors: bool) {
18231833 // transaction, and one which we will not, allowing B to claim the HTLC output in an aggregated
18241834 // revocation-claim transaction.
18251835
1826- let ( claimed_payment_preimage, claimed_payment_hash, ..) = route_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , 3_000_000 ) ;
1836+ let ( claimed_payment_preimage, claimed_payment_hash, ..) = route_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , 3_000_100 ) ;
18271837 let revoked_payment_hash = route_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , 4_000_000 ) . 1 ;
18281838
18291839 let htlc_cltv_timeout = nodes[ 1 ] . best_block_info ( ) . 1 + TEST_FINAL_CLTV + 1 ; // Note ChannelManager adds one to CLTV timeouts for safety
@@ -1857,14 +1867,14 @@ fn do_test_revoked_counterparty_aggregated_claims(anchors: bool) {
18571867 commitment_signed_dance ! ( nodes[ 1 ] , nodes[ 0 ] , fee_update. commitment_signed, false ) ;
18581868
18591869 nodes[ 0 ] . node . claim_funds ( claimed_payment_preimage) ;
1860- expect_payment_claimed ! ( nodes[ 0 ] , claimed_payment_hash, 3_000_000 ) ;
1870+ expect_payment_claimed ! ( nodes[ 0 ] , claimed_payment_hash, 3_000_100 ) ;
18611871 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
18621872 let _a_htlc_msgs = get_htlc_update_msgs ! ( & nodes[ 0 ] , nodes[ 1 ] . node. get_our_node_id( ) ) ;
18631873
18641874 assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableOnChannelClose {
1865- amount_satoshis: 100_000 - 4_000 - 3_000 ,
1875+ amount_satoshis: 100_000 - 4_000 - 3_000 - 1 /* rounded up msat parts of HTLCs */ ,
18661876 transaction_fee_satoshis: 0 ,
1867- outbound_payment_htlc_rounded_msat: 0 ,
1877+ outbound_payment_htlc_rounded_msat: 100 ,
18681878 outbound_forwarded_htlc_rounded_msat: 0 ,
18691879 inbound_claiming_htlc_rounded_msat: 0 ,
18701880 inbound_htlc_rounded_msat: 0 ,
@@ -1913,7 +1923,7 @@ fn do_test_revoked_counterparty_aggregated_claims(anchors: bool) {
19131923 let anchor_outputs_value = if anchors { channel:: ANCHOR_OUTPUT_VALUE_SATOSHI * 2 } else { 0 } ;
19141924 assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableAwaitingConfirmations {
19151925 // to_remote output in A's revoked commitment
1916- amount_satoshis: 100_000 - 4_000 - 3_000 ,
1926+ amount_satoshis: 100_000 - 4_000 - 3_000 - 1 /* rounded up msat parts of HTLCs */ ,
19171927 confirmation_height: to_remote_maturity,
19181928 } , Balance :: CounterpartyRevokedOutputClaimable {
19191929 // to_self output in A's revoked commitment
@@ -1968,7 +1978,7 @@ fn do_test_revoked_counterparty_aggregated_claims(anchors: bool) {
19681978
19691979 assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableAwaitingConfirmations {
19701980 // to_remote output in A's revoked commitment
1971- amount_satoshis: 100_000 - 4_000 - 3_000 ,
1981+ amount_satoshis: 100_000 - 4_000 - 3_000 - 1 /* rounded up msat parts of HTLCs */ ,
19721982 confirmation_height: to_remote_maturity,
19731983 } , Balance :: CounterpartyRevokedOutputClaimable {
19741984 // to_self output in A's revoked commitment
0 commit comments