bdk
bdk copied to clipboard
TxGraph::balance's API is too complicated
pub fn try_balance<C: ChainOracle, OI: Clone>(
&self,
chain: &C,
chain_tip: BlockId,
outpoints: impl IntoIterator<Item = (OI, OutPoint)>,
mut trust_predicate: impl FnMut(&OI, &Script) -> bool,
) -> Result<Balance, C::Error> {
OI is unnecessary. The caller passes it to us and then we query it. It can just be:
pub fn try_balance<C: ChainOracle>(
&self,
chain: &C,
chain_tip: BlockId,
outpoints: impl IntoIterator<Item = OutPoint>,
mut trust_predicate: impl FnMut(&OutPoint, &Script) -> bool,
) -> Result<Balance, C::Error> {
If the caller wants to know the value of OI in trust predicate it can just look it up itself via the OutPoint.
Probably a small change but I think we should push to 2.0 milestone.