Skip to content

scan-rpc: ignores wallet birthday #59

@GuiSchet

Description

@GuiSchet

I've been practicing on signet and got stuck here: scan-rpc just ignores the wallet's birthday and scans from genesis.

In cli/v2/src/main.rs, scan-rpc constructs the Emitter with start_height = 0:

// cli/v2/src/main.rs
Commands::ScanRpc { rpc_args } => {
    let rpc_client = rpc_args.new_client()?;
    let mut emitter = Emitter::new(
        &rpc_client,
        wallet.chain().tip(),
        0,                         
        NO_EXPECTED_MEMPOOL_TXIDS,
    );

scan-cbf in the same file already handles this correctly — it compares the birthday against the chain tip and uses whichever is higher:

// cli/v2/src/main.rs
let sync_point = if let (Some(height), Some(hash)) = (height, hash) {
    HeaderCheckpoint::new(height, hash)
} else if wallet.birthday.height <= wallet.chain().tip().height() {
    HeaderCheckpoint::new(wallet.chain().tip().height(), wallet.chain().tip().hash())
} else {
    HeaderCheckpoint::new(wallet.birthday.height, wallet.birthday.hash)
};

scan-rpc has no equivalent logic.

Reproduction

On signet, create a wallet with a birthday near the chain tip, then run scan-rpc.
The output will show the scanner starting from a very low block height and incrementing block by block through the entire chain history rather than jumping to the birthday height.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions