Skip to content

Remove ChainOracle trait by inverting dependency #1816

Open
@LLFourn

Description

@LLFourn

The ChainOracle trait is annoying. Initially designed to allow anyone to provide their own view of the chain. This is a noble goal but doing this via a trait means we force the ChainOracle to do it synchronously and have to handle errors from the ChainOracle.

ChainOracles are really only used for canonicalization. Instead of writing:

tx_graph.list_canonical_txs(&local_chain, chain_tip);

We could instead write:

let list_txs_task = tx_graph.list_canonical_txs(chain_tip);
let txs_iter = local_chain.canonicalize(list_txs_task);

Now if we want to replace the canonicalizing functionality with a bitcoin node or a CBF system. It can be sync or async, infallible or fallible and we don't have to care in BDK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionThere's still a discussion ongoing

    Type

    No type

    Projects

    Status

    Discussion

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions