@@ -781,7 +781,60 @@ impl ChainSource {
781781 }
782782 }
783783 } ,
784- Self :: BitcoindRpc { .. } => todo ! ( ) ,
784+ Self :: BitcoindRpc { bitcoind_rpc_client, tx_broadcaster, logger, .. } => {
785+ // While it's a bit unclear when we'd be able to lean on Bitcoin Core >v28
786+ // features, we should eventually switch to use `submitpackage` via the
787+ // `rust-bitcoind-json-rpc` crate rather than just broadcasting individual
788+ // transactions.
789+ let mut receiver = tx_broadcaster. get_broadcast_queue ( ) . await ;
790+ while let Some ( next_package) = receiver. recv ( ) . await {
791+ for tx in & next_package {
792+ let txid = tx. compute_txid ( ) ;
793+ let timeout_fut = tokio:: time:: timeout (
794+ Duration :: from_secs ( TX_BROADCAST_TIMEOUT_SECS ) ,
795+ bitcoind_rpc_client. broadcast_transaction ( tx) ,
796+ ) ;
797+ match timeout_fut. await {
798+ Ok ( res) => match res {
799+ Ok ( id) => {
800+ debug_assert_eq ! ( id, txid) ;
801+ log_trace ! (
802+ logger,
803+ "Successfully broadcast transaction {}" ,
804+ txid
805+ ) ;
806+ } ,
807+ Err ( e) => {
808+ log_error ! (
809+ logger,
810+ "Failed to broadcast transaction {}: {}" ,
811+ txid,
812+ e
813+ ) ;
814+ log_trace ! (
815+ logger,
816+ "Failed broadcast transaction bytes: {}" ,
817+ log_bytes!( tx. encode( ) )
818+ ) ;
819+ } ,
820+ } ,
821+ Err ( e) => {
822+ log_error ! (
823+ logger,
824+ "Failed to broadcast transaction due to timeout {}: {}" ,
825+ txid,
826+ e
827+ ) ;
828+ log_trace ! (
829+ logger,
830+ "Failed broadcast transaction bytes: {}" ,
831+ log_bytes!( tx. encode( ) )
832+ ) ;
833+ } ,
834+ }
835+ }
836+ }
837+ } ,
785838 }
786839 }
787840}
0 commit comments