From: Daniela Brozzoni Date: Wed, 8 Mar 2023 14:20:36 +0000 (+0100) Subject: examples: exit if balance < SEND_AMOUNT X-Git-Tag: v1.0.0-alpha.0~6^2~8 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/scripts/static/struct.ParseMagicError.html?a=commitdiff_plain;h=0aaf420f6d4de3010d3c193d63a904c76c8391a5;p=bdk examples: exit if balance < SEND_AMOUNT --- diff --git a/example-crates/wallet_electrum/src/main.rs b/example-crates/wallet_electrum/src/main.rs index 20ae9d0f..5145d593 100644 --- a/example-crates/wallet_electrum/src/main.rs +++ b/example-crates/wallet_electrum/src/main.rs @@ -77,8 +77,11 @@ fn main() -> Result<(), Box> { let balance = wallet.get_balance(); println!("Wallet balance after syncing: {} sats", balance.total()); - if balance.total() == 0 { - println!("Please send some coins to the receiving address"); + if balance.total() < SEND_AMOUNT { + println!( + "Please send at least {} sats to the receiving address", + SEND_AMOUNT + ); std::process::exit(0); } diff --git a/example-crates/wallet_esplora/src/main.rs b/example-crates/wallet_esplora/src/main.rs index 804139f8..d8eda32a 100644 --- a/example-crates/wallet_esplora/src/main.rs +++ b/example-crates/wallet_esplora/src/main.rs @@ -69,8 +69,11 @@ fn main() -> Result<(), Box> { let balance = wallet.get_balance(); println!("Wallet balance after syncing: {} sats", balance.total()); - if balance.total() == 0 { - println!("Please send some coins to the receiving address"); + if balance.total() < SEND_AMOUNT { + println!( + "Please send at least {} sats to the receiving address", + SEND_AMOUNT + ); std::process::exit(0); }