mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-21 22:11:48 +01:00
Merge pull request #2325 from btcpayserver/fix/nextnetworkfee-null
Returning 0 for NextNetworkFee if it's null
This commit is contained in:
commit
4f6ec3aa32
2 changed files with 6 additions and 3 deletions
|
@ -17,7 +17,8 @@ namespace BTCPayServer.Payments.Bitcoin
|
|||
|
||||
public decimal GetNextNetworkFee()
|
||||
{
|
||||
return NextNetworkFee.ToDecimal(MoneyUnit.BTC);
|
||||
// NextNetworkFee is sometimes not initialized properly, so we return 0 in that case
|
||||
return NextNetworkFee?.ToDecimal(MoneyUnit.BTC) ?? 0;
|
||||
}
|
||||
|
||||
public decimal GetFeeRate()
|
||||
|
|
|
@ -143,9 +143,11 @@ namespace BTCPayServer.Payments.Bitcoin
|
|||
if (!_ExplorerProvider.IsAvailable(network))
|
||||
throw new PaymentMethodUnavailableException($"Full node not available");
|
||||
var prepare = (Prepare)preparePaymentObject;
|
||||
Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod onchainMethod =
|
||||
new Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod();
|
||||
var onchainMethod = new BitcoinLikeOnChainPaymentMethod();
|
||||
var blob = store.GetStoreBlob();
|
||||
|
||||
// TODO: this needs to be refactored to move this logic into BitcoinLikeOnChainPaymentMethod
|
||||
// This is likely a constructor code
|
||||
onchainMethod.NetworkFeeMode = blob.NetworkFeeMode;
|
||||
onchainMethod.FeeRate = await prepare.GetFeeRate;
|
||||
switch (onchainMethod.NetworkFeeMode)
|
||||
|
|
Loading…
Add table
Reference in a new issue