Skip to content

Commit 99774a8

Browse files
Allow zero fee's while estimating spendable amount. (#144)
1 parent 0c246e4 commit 99774a8

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/Features/Blockcore.Features.Wallet/WalletTransactionHandler.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public void FundTransaction(TransactionBuildContext context, Transaction transac
160160

161161
// Create a recipient with a dummy destination address as it's required by NBitcoin's transaction builder.
162162
List<Recipient> recipients = new[] { new Recipient { Amount = new Money(maxSpendableAmount), ScriptPubKey = new Key().ScriptPubKey } }.ToList();
163-
Money fee;
163+
Money fee = Money.Zero;
164164

165165
try
166166
{
@@ -179,8 +179,11 @@ public void FundTransaction(TransactionBuildContext context, Transaction transac
179179
this.AddCoins(context);
180180
this.AddFee(context);
181181

182-
// Throw an exception if this code is reached, as building a transaction without any funds for the fee should always throw an exception.
183-
throw new WalletException("This should be unreachable; please find and fix the bug that caused this to be reached.");
182+
if (this.network.MinTxFee > Money.Zero)
183+
{
184+
// Throw an exception if this code is reached, as building a transaction without any funds for the fee should always throw an exception.
185+
throw new WalletException("This should be unreachable; please find and fix the bug that caused this to be reached.");
186+
}
184187
}
185188
catch (NotEnoughFundsException e)
186189
{

0 commit comments

Comments
 (0)