Skip to content

Commit c199d64

Browse files
thunderbiscuit110CodingP
authored andcommitted
refactor: create KeychainTxGraph type alias
1 parent 0a18206 commit c199d64

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/wallet/mod.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ pub use persisted::*;
8484
pub use utils::IsDust;
8585
pub use utils::TxDetails;
8686

87+
type KeychainTxGraph<K> = IndexedTxGraph<ConfirmationBlockTime, KeychainTxOutIndex<K>>;
88+
8789
/// A Bitcoin wallet
8890
///
8991
/// The `Wallet` acts as a way of coherently interfacing with output descriptors and related
@@ -106,7 +108,7 @@ pub struct Wallet {
106108
signers: Arc<SignersContainer>,
107109
change_signers: Arc<SignersContainer>,
108110
chain: LocalChain,
109-
tx_graph: IndexedTxGraph<ConfirmationBlockTime, KeychainTxOutIndex<KeychainKind>>,
111+
tx_graph: KeychainTxGraph<KeychainKind>,
110112
stage: ChangeSet,
111113
network: Network,
112114
secp: SecpCtx,
@@ -2321,9 +2323,7 @@ impl Wallet {
23212323

23222324
// Try to figure out the keychain and derivation for every input and output.
23232325
for (is_input, index, out) in utxos.into_iter() {
2324-
if let Some(&(keychain, child)) =
2325-
self.tx_graph.index.index_of_spk(out.script_pubkey)
2326-
{
2326+
if let Some(&(keychain, child)) = self.tx_graph.index.index_of_spk(out.script_pubkey) {
23272327
let desc = self.public_descriptor(keychain);
23282328
let desc = desc
23292329
.at_derivation_index(child)
@@ -2510,11 +2510,7 @@ impl Wallet {
25102510
.apply_header_connected_to(&block.header, height, connected_to)?
25112511
.into(),
25122512
);
2513-
changeset.merge(
2514-
self.tx_graph
2515-
.apply_block_relevant(block, height)
2516-
.into(),
2517-
);
2513+
changeset.merge(self.tx_graph.apply_block_relevant(block, height).into());
25182514
self.stage.merge(changeset);
25192515
Ok(())
25202516
}
@@ -2747,8 +2743,7 @@ fn make_indexed_graph(
27472743
change_descriptor: Option<ExtendedDescriptor>,
27482744
lookahead: u32,
27492745
use_spk_cache: bool,
2750-
) -> Result<IndexedTxGraph<ConfirmationBlockTime, KeychainTxOutIndex<KeychainKind>>, DescriptorError>
2751-
{
2746+
) -> Result<KeychainTxGraph<KeychainKind>, DescriptorError> {
27522747
let (indexed_graph, changeset) = IndexedTxGraph::from_changeset(
27532748
chain::indexed_tx_graph::ChangeSet {
27542749
tx_graph: tx_graph_changeset,

0 commit comments

Comments
 (0)