Skip to content

Commit 4062550

Browse files
committed
Merge #1658: Handle JsonRpcError in _estimate_fee_basic
100da5e Handle JsonRpcError in _estimate_fee_basic (Kristaps Kaupe) Pull request description: `_estimate_fee_basic` is supposed to return `None` if fee rate can't be estimated and then `estimate_fee_per_kb` handles that with hardcoded fallback fee. But `JsonRpcError` wasn't handled and it could fail when fee estimation is not working in Core. Fixes #1653. Previously it outputed unhandled error and hanged, now it's: ``` 2024-02-10 02:05:11,803 [DEBUG] rpc: estimatesmartfee [3] 2024-02-10 02:05:11,812 [WARNING] Could not source a fee estimate from Core 2024-02-10 02:05:11,813 [WARNING] Fee estimation for 3 block confirmation target failed. Falling back to default (randomized for privacy): 11976 sat/kvB (11.9 sat/vB). 2024-02-10 02:05:11,815 [DEBUG] rpc: getmempoolinfo [] 2024-02-10 02:05:11,818 [DEBUG] rpc: estimatesmartfee [3] 2024-02-10 02:05:11,820 [WARNING] Could not source a fee estimate from Core 2024-02-10 02:05:11,821 [WARNING] Fee estimation for 3 block confirmation target failed. Falling back to default (randomized for privacy): 10279 sat/kvB (10.2 sat/vB). 2024-02-10 02:05:11,849 [INFO] Using a fee of: 0.00001449 BTC (1449 sat). ``` Top commit has no ACKs. Tree-SHA512: 45bf55530f48a75fdbcc808db3ca8884f273a5b625c2a0bf03a1090f2bd1ebcafc51808e3822cf7684903b4918642b99d400974847d5ebcf6d4e66cab44620b2
2 parents 5fd2c99 + 100da5e commit 4062550

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/jmclient/blockchaininterface.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,12 @@ def _estimate_fee_basic(self,
593593
# cannot be estimated in that case the 2nd highest priority
594594
# should be used instead of falling back to hardcoded values
595595
tries = 2 if conf_target == 1 else 1
596+
rpc_result = None
596597
for i in range(tries):
597-
rpc_result = self._rpc('estimatesmartfee', [conf_target + i])
598+
try:
599+
rpc_result = self._rpc('estimatesmartfee', [conf_target + i])
600+
except JsonRpcError:
601+
continue
598602
if not rpc_result:
599603
# in case of connection error:
600604
return None

0 commit comments

Comments
 (0)