Handle locked funds (#1016)

* Handle locked coins
This commit is contained in:
Quentin Le Sceller 2018-05-01 09:49:00 -04:00 committed by GitHub
parent 9f890643b9
commit aa984ed550
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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