From aa984ed5508b32c8aa24cf175723737a8e9354cc Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Tue, 1 May 2018 09:49:00 -0400 Subject: [PATCH] Handle locked funds (#1016) * Handle locked coins --- wallet/src/sender.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wallet/src/sender.rs b/wallet/src/sender.rs index b4c633b02..20b6b875a 100644 --- a/wallet/src/sender.rs +++ b/wallet/src/sender.rs @@ -279,6 +279,10 @@ fn build_send_tx( let mut total: u64 = coins.iter().map(|c| c.value).sum(); let mut amount_with_fee = amount + fee; + if total == 0 { + return Err(ErrorKind::NotEnoughFunds(total as u64))?; + } + // Check if we need to use a change address if total > amount_with_fee { fee = tx_fee(coins.len(), 2, coins_proof_count(&coins), None);