examples: exit if balance < SEND_AMOUNT

This commit is contained in:
Daniela Brozzoni 2023-03-08 15:20:36 +01:00
parent 47faa881fb
commit 0aaf420f6d
No known key found for this signature in database
GPG Key ID: 7DE4F1FDCED0AB87
2 changed files with 10 additions and 4 deletions

View File

@ -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);
}

View File

@ -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);
}