@@ -926,10 +926,13 @@ async fn concurrent_connections_succeed() {
926926 }
927927}
928928
929- #[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
930- async fn splice_channel ( ) {
929+ async fn run_splice_channel_test ( bitcoind_chain_source : bool ) {
931930 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
932- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
931+ let chain_source = if bitcoind_chain_source {
932+ TestChainSource :: BitcoindRpcSync ( & bitcoind)
933+ } else {
934+ TestChainSource :: Esplora ( & electrsd)
935+ } ;
933936 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
934937
935938 let address_a = node_a. onchain_payment ( ) . new_address ( ) . unwrap ( ) ;
@@ -994,7 +997,7 @@ async fn splice_channel() {
994997 // Splice-in funds for Node B so that it has outbound liquidity to make a payment
995998 node_b. splice_in ( & user_channel_id_b, node_a. node_id ( ) , 4_000_000 ) . unwrap ( ) ;
996999
997- expect_splice_pending_event ! ( node_a, node_b. node_id( ) ) ;
1000+ let txo = expect_splice_pending_event ! ( node_a, node_b. node_id( ) ) ;
9981001 expect_splice_pending_event ! ( node_b, node_a. node_id( ) ) ;
9991002
10001003 generate_blocks_and_wait ( & bitcoind. client , & electrsd. client , 6 ) . await ;
@@ -1005,11 +1008,16 @@ async fn splice_channel() {
10051008 expect_channel_ready_event ! ( node_a, node_b. node_id( ) ) ;
10061009 expect_channel_ready_event ! ( node_b, node_a. node_id( ) ) ;
10071010
1008- let splice_in_fee_sat = 252 ;
1011+ let expected_splice_in_fee_sat = 252 ;
1012+
1013+ let payments = node_b. list_payments ( ) ;
1014+ let payment =
1015+ payments. into_iter ( ) . find ( |p| p. id == PaymentId ( txo. txid . to_byte_array ( ) ) ) . unwrap ( ) ;
1016+ assert_eq ! ( payment. fee_paid_msat, Some ( expected_splice_in_fee_sat * 1_000 ) ) ;
10091017
10101018 assert_eq ! (
10111019 node_b. list_balances( ) . total_onchain_balance_sats,
1012- premine_amount_sat - 4_000_000 - splice_in_fee_sat
1020+ premine_amount_sat - 4_000_000 - expected_splice_in_fee_sat
10131021 ) ;
10141022 assert_eq ! ( node_b. list_balances( ) . total_lightning_balance_sats, 4_000_000 ) ;
10151023
@@ -1032,7 +1040,7 @@ async fn splice_channel() {
10321040 let address = node_a. onchain_payment ( ) . new_address ( ) . unwrap ( ) ;
10331041 node_a. splice_out ( & user_channel_id_a, node_b. node_id ( ) , & address, amount_msat / 1000 ) . unwrap ( ) ;
10341042
1035- expect_splice_pending_event ! ( node_a, node_b. node_id( ) ) ;
1043+ let txo = expect_splice_pending_event ! ( node_a, node_b. node_id( ) ) ;
10361044 expect_splice_pending_event ! ( node_b, node_a. node_id( ) ) ;
10371045
10381046 generate_blocks_and_wait ( & bitcoind. client , & electrsd. client , 6 ) . await ;
@@ -1043,18 +1051,29 @@ async fn splice_channel() {
10431051 expect_channel_ready_event ! ( node_a, node_b. node_id( ) ) ;
10441052 expect_channel_ready_event ! ( node_b, node_a. node_id( ) ) ;
10451053
1046- let splice_out_fee_sat = 183 ;
1054+ let expected_splice_out_fee_sat = 183 ;
1055+
1056+ let payments = node_a. list_payments ( ) ;
1057+ let payment =
1058+ payments. into_iter ( ) . find ( |p| p. id == PaymentId ( txo. txid . to_byte_array ( ) ) ) . unwrap ( ) ;
1059+ assert_eq ! ( payment. fee_paid_msat, Some ( expected_splice_out_fee_sat * 1_000 ) ) ;
10471060
10481061 assert_eq ! (
10491062 node_a. list_balances( ) . total_onchain_balance_sats,
10501063 premine_amount_sat - 4_000_000 - opening_transaction_fee_sat + amount_msat / 1000
10511064 ) ;
10521065 assert_eq ! (
10531066 node_a. list_balances( ) . total_lightning_balance_sats,
1054- 4_000_000 - closing_transaction_fee_sat - anchor_output_sat - splice_out_fee_sat
1067+ 4_000_000 - closing_transaction_fee_sat - anchor_output_sat - expected_splice_out_fee_sat
10551068 ) ;
10561069}
10571070
1071+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
1072+ async fn splice_channel ( ) {
1073+ run_splice_channel_test ( false ) . await ;
1074+ run_splice_channel_test ( true ) . await ;
1075+ }
1076+
10581077#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
10591078async fn simple_bolt12_send_receive ( ) {
10601079 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
0 commit comments