Skip to content

Commit

Permalink
examples: exit if balance < SEND_AMOUNT
Browse files Browse the repository at this point in the history
  • Loading branch information
danielabrozzoni committed Mar 8, 2023
1 parent 47faa88 commit 0aaf420
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions example-crates/wallet_electrum/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
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);
}

Expand Down
7 changes: 5 additions & 2 deletions example-crates/wallet_esplora/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
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);
}

Expand Down

0 comments on commit 0aaf420

Please sign in to comment.