Skip to content

Add transaction_index Scanner Field to Scanners That Rely on from_block #179

@0xNeshi

Description

@0xNeshi

sync::from_block and historic builders would have the additional optional transaction_index builder function, that would allow devs to specify the exact transaction index in the from_block from which to start streaming.

let mut scanner = EventScannerBuilder::sync()
    .from_block(100)
    .transaction_index(5)
    .connect(provider)
    .await?;

// this means: "start streaming from block 100, discarding all logs prior to transaction index 5"

// Historical block range mode
let scanner = EventScannerBuilder::historic()
    .from_block(1000)
    .transaction_index(15)
    .to_block(2000)
    .max_block_range(500)
    .connect(provider.clone());

// "stream logs from block 1000 to block 2000, discarding all logs prior to transaction index 15"
  • DEFAULT_TRANSACTION_INDEX = 0
  • if the set transaction index is higher than the number of transactions that the specified block contains, the scanner would skip the whole block completely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions