if a network object is there but fee estimates are not available,
raise NoDynamicFeeEstimates in FeePolicy rather than in wallet. Also, show an error message in Qt
This commit is contained in:
@@ -243,13 +243,12 @@ class FeePolicy(Logger):
|
|||||||
) -> int:
|
) -> int:
|
||||||
if self.method == FeeMethod.FIXED:
|
if self.method == FeeMethod.FIXED:
|
||||||
return self.value
|
return self.value
|
||||||
if network is None and self.use_dynamic_estimates:
|
fee_per_kb = self.fee_per_kb(network)
|
||||||
|
if fee_per_kb is None and self.use_dynamic_estimates:
|
||||||
if allow_fallback_to_static_rates:
|
if allow_fallback_to_static_rates:
|
||||||
fee_per_kb = FEERATE_FALLBACK_STATIC_FEE
|
fee_per_kb = FEERATE_FALLBACK_STATIC_FEE
|
||||||
else:
|
else:
|
||||||
raise NoDynamicFeeEstimates()
|
raise NoDynamicFeeEstimates()
|
||||||
else:
|
|
||||||
fee_per_kb = self.fee_per_kb(network)
|
|
||||||
|
|
||||||
return self.estimate_fee_for_feerate(fee_per_kb, size)
|
return self.estimate_fee_for_feerate(fee_per_kb, size)
|
||||||
|
|
||||||
|
|||||||
@@ -569,6 +569,8 @@ class TxEditor(WindowModalDialog):
|
|||||||
self.error = long_warning
|
self.error = long_warning
|
||||||
else:
|
else:
|
||||||
messages.append(long_warning)
|
messages.append(long_warning)
|
||||||
|
if self.no_dynfee_estimates:
|
||||||
|
self.error = _('Fee estimates not available. Please set a fixed fee or feerate.')
|
||||||
if self.tx.get_dummy_output(DummyAddress.SWAP):
|
if self.tx.get_dummy_output(DummyAddress.SWAP):
|
||||||
messages.append(_('This transaction will send funds to a submarine swap.'))
|
messages.append(_('This transaction will send funds to a submarine swap.'))
|
||||||
# warn if spending unconf
|
# warn if spending unconf
|
||||||
|
|||||||
@@ -1854,9 +1854,6 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
|||||||
i_max_sum += weight
|
i_max_sum += weight
|
||||||
i_max.append((weight, i))
|
i_max.append((weight, i))
|
||||||
|
|
||||||
if fee_policy.method is not FeeMethod.FIXED and fee_policy.fee_per_kb(self.network) is None:
|
|
||||||
raise NoDynamicFeeEstimates()
|
|
||||||
|
|
||||||
for txin in coins:
|
for txin in coins:
|
||||||
self.add_input_info(txin)
|
self.add_input_info(txin)
|
||||||
nSequence = 0xffffffff - (2 if rbf else 1)
|
nSequence = 0xffffffff - (2 if rbf else 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user