fix: tolerate non-numeric keys in get_fee_estimates (mempool.space deprecation warning)#212
fix: tolerate non-numeric keys in get_fee_estimates (mempool.space deprecation warning)#212Copexit wants to merge 1 commit into
Conversation
mempool.space added a non-numeric "warning" key to its deprecated /fee-estimates response. The strict HashMap<u16, f64> deserialization rejects it, so get_fee_estimates fails for any client pointed at mempool.space - most visibly ldk-node, whose Node::start() aborts on the failed fee-rate update. Parse leniently: deserialize to a permissive map and keep only entries whose key is a numeric confirmation target and whose value is a number. Applies to both the async and blocking clients. Refs #210
|
NACK. This client is not responsible for conforming to server implementations that deviate from the specification (https://github.com/Blockstream/esplora/blob/master/API.md#get-fee-estimates). Instead, Mempool should return |
|
Thanks for the review, and fair point on spec purity. The practical wrinkle: per #210, the mempool team has said they're keeping This change is strictly more lenient, Blockstream/spec-compliant responses parse identically; it only drops non-numeric keys. So there's no spec regression for compliant servers. But I'm happy to defer to whatever direction you prefer: fold it into the |
|
As mentioned in this comment I made. We should be pushing a fix shortly. However, most wallets will be converting "1" to something human readable like "fast" anyways, so it would be best if end users add a normal HTTP client to their apps (use the same version that bdk uses if you don't want to add a new dependency) and just pull Mempool's precise fee API values. |
|
Closing as mempool/mempool#6546 has been merged. |
mempool.space added a non-numeric
"warning"key to its (deprecated)/fee-estimatesresponse:{"1":4.8, ... ,"1008":0.1,"warning":"This endpoint is deprecated ... use /api/v1/fees/precise"}get_fee_estimatesdeserializes the body asHashMap<u16, f64>, so the"warning"key fails to parse and the whole call errors. Any client pointed at a mempool.space Esplora is affected.The most severe downstream impact is ldk-node: it calls
get_fee_estimatesduringNode::start(), so the failed parse makes the node refuse to start and crash-loop on restart. This is a real production failure mode (see #210).Fix
Parse
/fee-estimatesleniently: deserialize into a permissive map and keep only entries whose key is a numeric confirmation target and whose value is a number; ignore anything else (such as the"warning"string). Behavior is unchanged for spec-compliant servers (e.g. Blockstream). Applied to both the async and blocking clients.Changelog
get_fee_estimatestolerates non-numeric entries in the/fee-estimatesresponse (e.g. mempool.space deprecationwarning), which previously broke fee estimation for mempool.space-backed clients and prevented ldk-node from starting.Refs #210