Skip to content

Commit 19e3b5d

Browse files
committed
feat(chain): Add KeychainTxOutIndex::from_changeset constructor
This incentivies constructing `KeychainTxOutIndex` from a changeset before inserting descriptors (to make use of the spk cache).
1 parent d761265 commit 19e3b5d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/chain/src/indexer/keychain_txout.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,13 @@ impl<K> KeychainTxOutIndex<K> {
236236

237237
/// Methods that are *re-exposed* from the internal [`SpkTxOutIndex`].
238238
impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
239+
/// Construct `KeychainTxOutIndex<K>` from the given `changeset`.
240+
pub fn from_changeset(changeset: ChangeSet) -> Self {
241+
let mut out = Self::default();
242+
out.apply_changeset(changeset);
243+
out
244+
}
245+
239246
/// Get the set of indexed outpoints, corresponding to tracked keychains.
240247
pub fn outpoints(&self) -> &BTreeSet<KeychainIndexed<K, OutPoint>> {
241248
self.inner.outpoints()

0 commit comments

Comments
 (0)