@@ -58,11 +58,16 @@ pub struct DbMigration {
5858pub struct FederationObserver {
5959 connection_pool : deadpool_postgres:: Pool ,
6060 admin_auth : String ,
61+ mempool_url : String ,
6162 task_group : TaskGroup ,
6263}
6364
6465impl FederationObserver {
65- pub async fn new ( database : & str , admin_auth : & str ) -> anyhow:: Result < FederationObserver > {
66+ pub async fn new (
67+ database : & str ,
68+ admin_auth : & str ,
69+ mempool_url : & str ,
70+ ) -> anyhow:: Result < FederationObserver > {
6671 let connection_pool = {
6772 let pool_config = deadpool_postgres:: Config {
6873 url : Some ( database. to_owned ( ) ) ,
@@ -74,6 +79,7 @@ impl FederationObserver {
7479 let slf = FederationObserver {
7580 connection_pool,
7681 admin_auth : admin_auth. to_owned ( ) ,
82+ mempool_url : mempool_url. to_owned ( ) ,
7783 task_group : Default :: default ( ) ,
7884 } ;
7985
@@ -503,7 +509,7 @@ impl FederationObserver {
503509 }
504510
505511 async fn fetch_block_times_inner ( & self ) -> anyhow:: Result < ( ) > {
506- let builder = esplora_client:: Builder :: new ( "https://mempool.space/api" ) ;
512+ let builder = esplora_client:: Builder :: new ( & self . mempool_url ) ;
507513 let esplora_client = builder. build_async ( ) ?;
508514
509515 // TODO: find a better way to pre-seed the DB so we don't have to bother
@@ -679,6 +685,7 @@ impl FederationObserver {
679685 item_idx as u64 ,
680686 item. peer ,
681687 module_ci,
688+ & self . mempool_url ,
682689 )
683690 . await ?;
684691 }
@@ -1085,6 +1092,7 @@ impl FederationObserver {
10851092 item_index : u64 ,
10861093 peer_id : PeerId ,
10871094 ci : DynModuleConsensusItem ,
1095+ mempool_url : & str ,
10881096 ) -> Result < ( ) , tokio_postgres:: Error > {
10891097 let kind = instance_to_kind ( config, ci. module_instance_id ( ) ) ;
10901098
@@ -1238,7 +1246,7 @@ impl FederationObserver {
12381246 let esplora_txid = esplora_client:: Txid :: from_str ( peg_out_txid. as_str ( ) )
12391247 . expect ( "Couldn't create esplora txid" ) ;
12401248
1241- let builder = esplora_client:: Builder :: new ( "https://mempool.space/api" ) ;
1249+ let builder = esplora_client:: Builder :: new ( mempool_url ) ;
12421250 let client = builder
12431251 . build_async ( )
12441252 . expect ( "Failed to build esplora client" ) ;
0 commit comments