Skip to content

Commit 063a7aa

Browse files
randomloginclaude
andcommitted
fix(cbf): treat UnknownHash as skip-this-cycle in fee_rate_cache_from_cbf
After a checkpoint-based resume, `requester.chain_tip()` can return the checkpoint hash which has no `BlockNode` in kyoto's tree yet, causing `get_block` to fail with `FetchBlockError::UnknownHash` and surfacing as `FeerateEstimationUpdateFailed` from `node.start()`. Skip the cycle and retry later instead of erroring. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent dd3b9c3 commit 063a7aa

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/chain/cbf.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
1414
use bdk_chain::{BlockId, ConfirmationBlockTime, TxUpdate};
1515
use bdk_wallet::Update;
1616
use bip157::chain::{BlockHeaderChanges, ChainState};
17+
use bip157::error::FetchBlockError;
1718
use bip157::{
1819
BlockHash, Builder, Client, Event, HeaderCheckpoint, Info, Node as CbfNode, Requester,
1920
SyncUpdate, TrustedPeer, Warning,
@@ -914,6 +915,18 @@ impl CbfChainSource {
914915
.await
915916
{
916917
Ok(Ok(indexed_block)) => indexed_block,
918+
Ok(Err(FetchBlockError::UnknownHash)) => {
919+
// Kyoto doesn't know this block yet (e.g. startup before
920+
// filter sync, or hash is at/below the resume checkpoint).
921+
// Skip this cycle and try again later.
922+
log_debug!(
923+
self.logger,
924+
"CBF node does not yet have block {} for fee estimation; \
925+
skipping until sync progresses.",
926+
current_hash,
927+
);
928+
return Ok(None);
929+
},
917930
Ok(Err(e)) => {
918931
log_error!(
919932
self.logger,

0 commit comments

Comments
 (0)