pub fn run<S: net::ToSocketAddrs + fmt::Debug>(
    seed: S,
    addresses: Vec<Address>,
    genesis: Height,
) -> Result<(), Error> {
    let mut cfg = Config {
        listen: vec![], // Don't listen for incoming connections.
        network: Network::Mainnet,
        ..Config::default()
    };
    cfg.seed(&[seed])?;
    // TODO: This shouldn't have to be specified manually. We should have a "discovery mode"
    // that can be static or dynamic.
    cfg.target_outbound_peers = cfg.connect.len().min(8);

    // Create a new client using `Reactor` for networking.
    let client = Client::<Reactor>::new(cfg)?;
    let handle = client.handle();

    // Start the network client in the background.
    thread::spawn(|| client.run().unwrap());

    // Create a new wallet and rescan the chain from the provided `genesis` height for
    // matching addresses.
    let mut wallet = Wallet::new(handle, addresses);

    wallet.rescan(Rescan { genesis })?;

    log::info!("Balance is {} sats", wallet.balance());
    log::info!("Rescan complete.");

    Ok(())
}
/// Entry point for running the wallet.
Entry point for running the wallet.
Entry point for running the wallet .
pub fn run<S: net::ToSocketAddrs + fmt::Debug>(
    seed: S,
    addresses: Vec<Address>,
    genesis: Height,
) -> Result<(), Error> {
    let mut cfg = Config {
        listen: vec![], // Don't listen for incoming connections.
        network: Network::Mainnet,
        ..Config::default()
    };
    cfg.seed(&[seed])?;
    // TODO: This shouldn't have to be specified manually. We should have a "discovery mode"
    // that can be static or dynamic.
    cfg.target_outbound_peers = cfg.connect.len().min(8);
    // Create a new client using `Reactor` for networking.
    let client = Client::<Reactor>::new(cfg)?;
    let handle = client.handle();
    // Start the network client in the background.
    thread::spawn(|| client.run().unwrap());
    // Create a new wallet and rescan the chain from the provided `genesis` height for
    // matching addresses.
    let mut wallet = Wallet::new(handle, addresses);
    wallet.rescan(Rescan { genesis })?;
    log::info!("Balance is {} sats", wallet.balance());
    log::info!("Rescan complete.");
    Ok(())
}
pub fn run < S : net :: ToSocketAddrs + fmt :: Debug > ( seed : S , addresses : Vec < Address > , genesis : Height , ) -> Result < ( ) , Error > { let mut cfg = Config { listen : vec ! [ ] , // Don't listen for incoming connections. network : Network :: Mainnet , .. Config :: default ( ) } ; cfg . seed ( & [ seed ] ) ? ; // TODO: This shouldn't have to be specified manually. We should have a "discovery mode" // that can be static or dynamic. cfg . target_outbound_peers = cfg . connect . len ( ) . min ( 8 ) ; // Create a new client using `Reactor` for networking. let client = Client :: < Reactor > :: new ( cfg ) ? ; let handle = client . handle ( ) ; // Start the network client in the background. thread :: spawn ( | | client . run ( ) . unwrap ( ) ) ; // Create a new wallet and rescan the chain from the provided `genesis` height for // matching addresses. let mut wallet = Wallet :: new ( handle , addresses ) ; wallet . rescan ( Rescan { genesis } ) ? ; log :: info ! ( " " wallet balance ( ) ) ; log :: info ! ( " " ) ; Ok ( ( ) ) }
Entry point for running the wallet.
Entry point for running the wallet .
seed
S
addresses
Vec<Address>
genesis
Height