Skip to content

rescanblockchain/loaddescriptor silently drop matched blocks when the block fetch fails #1098

Description

@jvsena42

Description

In rescan_with_block_filters (crates/floresta-node/src/json_rpc/server.rs, ~L616) matched blocks are downloaded with:

for block in blocks {
    if let Ok(Some(block)) = node.get_block(block).await {
        let height = chain.get_block_height(&block.block_hash()).unwrap().unwrap();
        wallet.block_process(&block, height);
    }
}

NodeInterface::get_block resolves three ways: Ok(Some), Ok(None) (peer replied NOTFOUND), and Err(RecvError) (responder dropped — e.g. MAX_INFLIGHT_REQUESTS reached or peer disconnected). The if let Ok(Some(..)) silently discards the latter two, so a matched block that momentarily fails to download is dropped from the rescan and never retried — the wallet permanently misses the transactions it carried, even though the rescan reports success.

Impact

On bandwidth/peer-constrained setups (notably the Android port, jvsena42/mandacaru#81) users see wallet history missing transactions after a "successful" rescan and must re-run rescanblockchain many times — each pass logs a different set of rescan filter hits as different blocks happen to succeed.

Suggested fix

Retry failed fetches (bounded, with backoff) so one rescan processes every matched block; surface a count of any blocks still unreachable after the cap. Reference implementation: jvsena42/Floresta-mandacaru#17.

Note: the reference PR targets a fork ~1 month behind master, so it may need light adaptation (e.g. the recent address-derivation centralization).

Metadata

Metadata

Assignees

No one assigned

    Labels

    reliabilityRelated to runtime reliability, stability and production readiness

    Type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions