Skip to content

Commit 20ec7a3

Browse files
randomloginclaude
authored 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 db5e6b3 commit 20ec7a3

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,
@@ -915,6 +916,18 @@ impl CbfChainSource {
915916
.await
916917
{
917918
Ok(Ok(indexed_block)) => indexed_block,
919+
Ok(Err(FetchBlockError::UnknownHash)) => {
920+
// Kyoto doesn't know this block yet (e.g. startup before
921+
// filter sync, or hash is at/below the resume checkpoint).
922+
// Skip this cycle and try again later.
923+
log_debug!(
924+
self.logger,
925+
"CBF node does not yet have block {} for fee estimation; \
926+
skipping until sync progresses.",
927+
current_hash,
928+
);
929+
return Ok(None);
930+
},
918931
Ok(Err(e)) => {
919932
log_error!(
920933
self.logger,

0 commit comments

Comments
 (0)