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.
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:
We could instead write:
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.