[bdk_chain_redesign] Rm unnecessary code and premature optimisation

* Remove `chain_oracle::CacheBackend` for now as it is not used.
* `SparseChain` does not need to implement `ChainOracle`.
* Remove filter predicate for `list..` methods of `TxGraph` and
  `IndexedTxGraph` as this is premature optimisation.
* `Append` can be implemented for all `BTreeMap`s and `BTreeSet`s,
  instead of only `local_chain::ChangeSet`.
This commit is contained in:
志宇
2023-04-20 18:07:26 +08:00
parent 6c49570742
commit 34a7bf5afe
6 changed files with 76 additions and 203 deletions

View File

@@ -3,7 +3,7 @@ use core::convert::Infallible;
use alloc::collections::{BTreeMap, BTreeSet};
use bitcoin::BlockHash;
use crate::{Append, BlockId, ChainOracle};
use crate::{BlockId, ChainOracle};
/// This is a local implementation of [`ChainOracle`].
///
@@ -180,12 +180,6 @@ impl LocalChain {
/// [`determine_changeset`]: LocalChain::determine_changeset
pub type ChangeSet = BTreeMap<u32, Option<BlockHash>>;
impl Append for ChangeSet {
fn append(&mut self, mut other: Self) {
BTreeMap::append(self, &mut other)
}
}
/// Represents an update failure of [`LocalChain`] due to the update not connecting to the original
/// chain.
///