mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Coin selection with small amounts fix (#2144)
* coin selection fix for sending with an amount <= smallest output * rustfmt
This commit is contained in:
parent
793e3843f0
commit
df62fd6d95
2 changed files with 7 additions and 5 deletions
|
@ -48,8 +48,9 @@ impl WalletCommAdapter for HTTPWalletCommAdapter {
|
|||
let url = format!("{}/v1/wallet/foreign/receive_tx", dest);
|
||||
debug!("Posting transaction slate to {}", url);
|
||||
|
||||
let res = api::client::post(url.as_str(), None, slate)
|
||||
.context(ErrorKind::ClientCallback("Posting transaction slate"))?;
|
||||
let res = api::client::post(url.as_str(), None, slate).context(
|
||||
ErrorKind::ClientCallback("Posting transaction slate (is recipient listening?)"),
|
||||
)?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ where
|
|||
K: Keychain,
|
||||
{
|
||||
// select some spendable coins from the wallet
|
||||
let (max_outputs, coins) = select_coins(
|
||||
let (max_outputs, mut coins) = select_coins(
|
||||
wallet,
|
||||
amount,
|
||||
current_height,
|
||||
|
@ -291,7 +291,7 @@ where
|
|||
}
|
||||
|
||||
// select some spendable coins from the wallet
|
||||
let (_, coins) = select_coins(
|
||||
coins = select_coins(
|
||||
wallet,
|
||||
amount_with_fee,
|
||||
current_height,
|
||||
|
@ -299,7 +299,8 @@ where
|
|||
max_outputs,
|
||||
selection_strategy_is_use_all,
|
||||
parent_key_id,
|
||||
);
|
||||
)
|
||||
.1;
|
||||
fee = tx_fee(coins.len(), num_outputs, 1, None);
|
||||
total = coins.iter().map(|c| c.value).sum();
|
||||
amount_with_fee = amount + fee;
|
||||
|
|
Loading…
Reference in a new issue