mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-03 18:47:38 +01:00
Filter dust from coin selection (#3866)
This commit is contained in:
parent
3162c1b2d0
commit
42d6955f79
1 changed files with 8 additions and 1 deletions
|
@ -2,6 +2,7 @@ package org.bitcoins.wallet.internal
|
|||
|
||||
import org.bitcoins.core.api.wallet.db.{AccountDb, SpendingInfoDb}
|
||||
import org.bitcoins.core.api.wallet.{CoinSelectionAlgo, CoinSelector}
|
||||
import org.bitcoins.core.policy.Policy
|
||||
import org.bitcoins.core.protocol.transaction._
|
||||
import org.bitcoins.core.wallet.builder._
|
||||
import org.bitcoins.core.wallet.fee.FeeUnit
|
||||
|
@ -83,9 +84,15 @@ trait FundTransactionHandling extends WalletLogger { self: Wallet =>
|
|||
val selectedUtxosF: Future[Vector[(SpendingInfoDb, Transaction)]] =
|
||||
for {
|
||||
walletUtxos <- utxosF
|
||||
|
||||
// filter out dust
|
||||
selectableUtxos = walletUtxos
|
||||
.map(_._1)
|
||||
.filter(_.output.value > Policy.dustThreshold)
|
||||
|
||||
utxos = CoinSelector.selectByAlgo(
|
||||
coinSelectionAlgo = coinSelectionAlgo,
|
||||
walletUtxos = walletUtxos.map(_._1),
|
||||
walletUtxos = selectableUtxos,
|
||||
outputs = destinations,
|
||||
feeRate = feeRate,
|
||||
longTermFeeRateOpt = Some(self.walletConfig.longTermFeeRate)
|
||||
|
|
Loading…
Add table
Reference in a new issue