forked from bitcoindevkit/bdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(chain): add SyncRequest and FullScanRequest structures
remove unneeded assert_debug in tx_graph feat(chain): add SyncRequest and FullScanRequest structures
- Loading branch information
1 parent
0a2a570
commit d74d9f5
Showing
3 changed files
with
35 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use crate::collections::BTreeMap; | ||
use crate::local_chain::CheckPoint; | ||
use alloc::vec::Vec; | ||
use bitcoin::{OutPoint, ScriptBuf, Txid}; | ||
|
||
/// Data required to perform a spk-based blockchain client sync. | ||
/// | ||
/// A client sync fetches relevant chain data for a known list of scripts, transaction ids and | ||
/// outpoints. The sync process also extends the given local chain [`CheckPoint`]. | ||
pub struct SyncRequest { | ||
/// Transactions that spend from or to these script pubkeys. | ||
pub spks: Vec<ScriptBuf>, | ||
/// Transactions with these txids. | ||
pub txids: Vec<Txid>, | ||
/// Transactions with these outpoints or spend from these outpoints. | ||
pub outpoints: Vec<OutPoint>, | ||
/// The local chain checkpoint. The sync process will return a new chain that extends this one. | ||
pub checkpoint: CheckPoint, | ||
} | ||
|
||
/// Data required to perform a spk-based blockchain client full scan. | ||
/// | ||
/// A client full scan iterates through all the scripts for the given keychains, fetching relevant | ||
/// data until some stop gap number of scripts is found that have no data. This operation is | ||
/// generally only used when importing or restoring previously used keychains in which the list of | ||
/// used scripts is not known. The full scan process also extends the given local chain [`CheckPoint`]. | ||
pub struct FullScanRequest<K, I> { | ||
/// Iterators of script pubkeys indexed by the keychain index. | ||
pub spks_by_keychain: BTreeMap<K, I>, | ||
/// The local chain checkpoint. The scan process will return a new chain that extends this one. | ||
pub checkpoint: CheckPoint, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters