@@ -29,6 +29,37 @@ use crate::runtime::Runtime;
2929use crate :: types:: { Broadcaster , ChainMonitor , ChannelManager , DynStore , Sweeper , Wallet } ;
3030use crate :: { Error , PersistedNodeMetrics } ;
3131
32+ /// We use this parent-child TRUC package to make sure the configured chain source supports
33+ /// broadcasting packages via the `submitpackage` Bitcoin Core RPC.
34+ const PARENT_TXID : & str = "9a015f93fac6cb203c2b994e18b85176eb0354a22a468255516f3c6002d3f696" ;
35+ const PARENT_HEX : & str =
36+ "0300000000010160d0cdb72f2ddf719f40ca32f44614c67577fc75996140544003915683c34a310000000000fd\
37+ ffffff0201000000000000000451024e73876100000000000022512042731375894dad3b25092cd0f713dc5bee4\
38+ a71e30a95e1db3d880906d7eba1fa01409327942924218e4eb1635a7cce6706fcb37b8bbb61a2f0b86357356681\
39+ 4e09419a3501e02252043bb237d479304632282fe9159db9e9a6ae6ec5bedea9f0f115a97b0e00";
40+ const CHILD_TXID : & str = "d011b3ff78cdfb8b93822639ea87771847936b04bb83afc8763a7c02a386ae26" ;
41+ const CHILD_HEX : & str =
42+ "0300000000010296f6d302603c6f515582462aa25403eb7651b8184e992b3c20cbc6fa935f019a0000000000ff\
43+ ffffff96f6d302603c6f515582462aa25403eb7651b8184e992b3c20cbc6fa935f019a0100000000fdffffff015\
44+ 660000000000000225120ac18cd599a1be003595854e2eeec18dbe1c92d04b0ba05812d04445e3fcf16bc000140\
45+ 1462a35808d77a164f0a23a84c4721d1545befd09ad19945bb8aa0ea5576953a9699038725f944b1bc429942ef4\
46+ 7e6504a554babf022cb15db53be2d8c1dbfe5a97b0e00";
47+
48+ fn dummy_package ( ) -> [ bitcoin:: Transaction ; 2 ] {
49+ use bitcoin:: consensus:: Decodable ;
50+ use bitcoin:: hex:: FromHex ;
51+ use bitcoin:: Transaction ;
52+ let parent_tx_bytes = Vec :: from_hex ( PARENT_HEX ) . expect ( "read from a constant" ) ;
53+ let child_tx_bytes = Vec :: from_hex ( CHILD_HEX ) . expect ( "read from a constant" ) ;
54+ let parent =
55+ Transaction :: consensus_decode ( & mut & parent_tx_bytes[ ..] ) . expect ( "read from a constant" ) ;
56+ let child =
57+ Transaction :: consensus_decode ( & mut & child_tx_bytes[ ..] ) . expect ( "read from a constant" ) ;
58+ assert_eq ! ( parent. compute_txid( ) . to_string( ) , PARENT_TXID ) ;
59+ assert_eq ! ( child. compute_txid( ) . to_string( ) , CHILD_TXID ) ;
60+ [ parent, child]
61+ }
62+
3263pub ( crate ) enum WalletSyncStatus {
3364 Completed ,
3465 InProgress { subscribers : tokio:: sync:: broadcast:: Sender < Result < ( ) , Error > > } ,
@@ -438,6 +469,26 @@ impl ChainSource {
438469 }
439470 }
440471
472+ pub ( crate ) async fn validate_zero_fee_commitments_support_if_required (
473+ & self , zero_fee_commitments_support_required : bool ,
474+ ) -> Result < ( ) , Error > {
475+ if !zero_fee_commitments_support_required {
476+ return Ok ( ( ) ) ;
477+ }
478+
479+ match & self . kind {
480+ ChainSourceKind :: Esplora ( esplora_chain_source) => {
481+ esplora_chain_source. validate_zero_fee_commitments_support ( ) . await
482+ } ,
483+ ChainSourceKind :: Electrum ( electrum_chain_source) => {
484+ electrum_chain_source. validate_zero_fee_commitments_support ( ) . await
485+ } ,
486+ ChainSourceKind :: Bitcoind ( bitcoind_chain_source) => {
487+ bitcoind_chain_source. validate_zero_fee_commitments_support ( ) . await
488+ } ,
489+ }
490+ }
491+
441492 pub ( crate ) async fn continuously_process_broadcast_queue (
442493 & self , mut stop_tx_bcast_receiver : tokio:: sync:: watch:: Receiver < ( ) > ,
443494 ) {
0 commit comments