@@ -8,10 +8,6 @@ use crate::actors::shutdown_controller::signals::outbound::Shutdown;
88use crate :: lib:: error:: { DfxError , DfxResult } ;
99#[ cfg( unix) ]
1010use crate :: lib:: info:: replica_rev;
11- #[ cfg( unix) ]
12- use crate :: lib:: integrations:: bitcoin:: initialize_bitcoin_canister;
13- #[ cfg( unix) ]
14- use crate :: lib:: integrations:: create_integrations_agent;
1511use actix:: {
1612 Actor , ActorContext , ActorFutureExt , Addr , AsyncContext , Context , Handler , Recipient ,
1713 ResponseActFuture , Running , WrapFuture ,
@@ -58,7 +54,7 @@ pub struct Config {
5854 pub effective_config_path : PathBuf ,
5955 pub replica_config : ReplicaConfig ,
6056 pub bitcoind_addr : Option < Vec < SocketAddr > > ,
61- pub bitcoin_integration_config : Option < BitcoinIntegrationConfig > ,
57+ pub enable_bitcoin : bool ,
6258 pub port : Option < u16 > ,
6359 pub port_file : PathBuf ,
6460 pub pid_file : PathBuf ,
@@ -67,11 +63,6 @@ pub struct Config {
6763 pub pocketic_proxy_config : PocketIcProxyConfig ,
6864}
6965
70- #[ derive( Clone ) ]
71- pub struct BitcoinIntegrationConfig {
72- pub canister_init_arg : String ,
73- }
74-
7566/// A PocketIC actor. Starts the server, can subscribe to a Ready signal and a
7667/// Killed signal.
7768/// This starts a thread that monitors the process and send signals to any subscriber
@@ -287,7 +278,7 @@ fn pocketic_start_thread(
287278 port,
288279 & config. effective_config_path ,
289280 & config. bitcoind_addr ,
290- & config. bitcoin_integration_config ,
281+ config. enable_bitcoin ,
291282 & config. replica_config ,
292283 config. pocketic_proxy_config . domains . clone ( ) ,
293284 config. pocketic_proxy_config . bind ,
@@ -350,7 +341,7 @@ async fn initialize_pocketic(
350341 port : u16 ,
351342 effective_config_path : & Path ,
352343 bitcoind_addr : & Option < Vec < SocketAddr > > ,
353- bitcoin_integration_config : & Option < BitcoinIntegrationConfig > ,
344+ enable_bitcoin : bool ,
354345 replica_config : & ReplicaConfig ,
355346 domains : Option < Vec < String > > ,
356347 addr : SocketAddr ,
@@ -383,10 +374,11 @@ async fn initialize_pocketic(
383374 }
384375 }
385376
377+ let icp_features = IcpFeatures :: default ( ) ;
386378 let icp_features = if replica_config. system_canisters {
387379 // Explicitly enabling specific system canisters here
388380 // ensures we'll notice if pocket-ic adds support for additional ones
389- Some ( IcpFeatures {
381+ IcpFeatures {
390382 registry : Some ( IcpFeaturesConfig :: default ( ) ) ,
391383 cycles_minting : Some ( IcpFeaturesConfig :: default ( ) ) ,
392384 icp_token : Some ( IcpFeaturesConfig :: default ( ) ) ,
@@ -395,10 +387,18 @@ async fn initialize_pocketic(
395387 sns : Some ( IcpFeaturesConfig :: default ( ) ) ,
396388 ii : Some ( IcpFeaturesConfig :: default ( ) ) ,
397389 nns_ui : Some ( IcpFeaturesConfig :: default ( ) ) ,
398- bitcoin : None ,
399- } )
390+ bitcoin : icp_features. bitcoin ,
391+ }
392+ } else {
393+ icp_features
394+ } ;
395+ let icp_features = if bitcoind_addr. is_some ( ) || enable_bitcoin {
396+ IcpFeatures {
397+ bitcoin : Some ( IcpFeaturesConfig :: default ( ) ) ,
398+ ..icp_features
399+ }
400400 } else {
401- None
401+ icp_features
402402 } ;
403403
404404 let resp = init_client
@@ -412,7 +412,7 @@ async fn initialize_pocketic(
412412 } ) ,
413413 log_level : Some ( replica_config. log_level . to_pocketic_string ( ) ) ,
414414 bitcoind_addr : bitcoind_addr. clone ( ) ,
415- icp_features,
415+ icp_features : Some ( icp_features ) ,
416416 http_gateway_config : Some ( InstanceHttpGatewayConfig {
417417 ip_addr : Some ( addr. ip ( ) . to_string ( ) ) ,
418418 port : Some ( addr. port ( ) ) ,
@@ -455,11 +455,6 @@ async fn initialize_pocketic(
455455 debug ! ( logger, "Waiting for replica to report healthy status" ) ;
456456 crate :: lib:: replica:: status:: ping_and_wait ( & agent_url) . await ?;
457457
458- if let Some ( bitcoin_integration_config) = bitcoin_integration_config {
459- let agent = create_integrations_agent ( & agent_url, & logger) . await ?;
460- initialize_bitcoin_canister ( & agent, & logger, bitcoin_integration_config. clone ( ) ) . await ?;
461- }
462-
463458 debug ! ( logger, "Initialized PocketIC with gateway." ) ;
464459 Ok ( server_instance)
465460}
@@ -469,7 +464,7 @@ fn initialize_pocketic(
469464 _: u16 ,
470465 _: & Path ,
471466 _: & Option < Vec < SocketAddr > > ,
472- _: & Option < BitcoinIntegrationConfig > ,
467+ _: bool ,
473468 _: & ReplicaConfig ,
474469 _: Option < Vec < String > > ,
475470 _: SocketAddr ,
0 commit comments