chore(chain)!: Rename Append to Merge

This commit is contained in:
Wei Chen
2024-07-04 22:09:04 +08:00
parent db8fbd729d
commit 962305f415
16 changed files with 117 additions and 117 deletions

View File

@@ -16,7 +16,7 @@ use bdk_chain::{
indexed_tx_graph,
indexer::keychain_txout,
local_chain::{self, LocalChain},
Append, ConfirmationTimeHeightAnchor, IndexedTxGraph,
ConfirmationTimeHeightAnchor, IndexedTxGraph, Merge,
};
use example_cli::{
anyhow,
@@ -191,7 +191,7 @@ fn main() -> anyhow::Result<()> {
.apply_update(emission.checkpoint)
.expect("must always apply as we receive blocks in order from emitter");
let graph_changeset = graph.apply_block_relevant(&emission.block, height);
db_stage.append((chain_changeset, graph_changeset));
db_stage.merge((chain_changeset, graph_changeset));
// commit staged db changes in intervals
if last_db_commit.elapsed() >= DB_COMMIT_DELAY {
@@ -235,7 +235,7 @@ fn main() -> anyhow::Result<()> {
);
{
let db = &mut *db.lock().unwrap();
db_stage.append((local_chain::ChangeSet::default(), graph_changeset));
db_stage.merge((local_chain::ChangeSet::default(), graph_changeset));
if let Some(changeset) = db_stage.take() {
db.append_changeset(&changeset)?;
}
@@ -321,7 +321,7 @@ fn main() -> anyhow::Result<()> {
continue;
}
};
db_stage.append(changeset);
db_stage.merge(changeset);
if last_db_commit.elapsed() >= DB_COMMIT_DELAY {
let db = &mut *db.lock().unwrap();

View File

@@ -20,7 +20,7 @@ use bdk_chain::{
descriptor::{DescriptorSecretKey, KeyMap},
Descriptor, DescriptorPublicKey,
},
Anchor, Append, ChainOracle, DescriptorExt, FullTxOut,
Anchor, ChainOracle, DescriptorExt, FullTxOut, Merge,
};
pub use bdk_file_store;
pub use clap;
@@ -263,7 +263,7 @@ where
.index
.next_unused_spk(&internal_keychain)
.expect("Must exist");
changeset.append(change_changeset);
changeset.merge(change_changeset);
let change_plan = bdk_tmp_plan::plan_satisfaction(
&graph
@@ -456,7 +456,7 @@ pub fn handle_commands<CS: clap::Subcommand, S: clap::Args, A: Anchor, O: ChainO
where
O::Error: std::error::Error + Send + Sync + 'static,
C: Default
+ Append
+ Merge
+ DeserializeOwned
+ Serialize
+ From<KeychainChangeSet<A>>
@@ -675,7 +675,7 @@ where
/// The initial state returned by [`init`].
pub struct Init<CS: clap::Subcommand, S: clap::Args, C>
where
C: Default + Append + Serialize + DeserializeOwned + Debug + Send + Sync + 'static,
C: Default + Merge + Serialize + DeserializeOwned + Debug + Send + Sync + 'static,
{
/// Arguments parsed by the cli.
pub args: Args<CS, S>,
@@ -697,7 +697,7 @@ pub fn init<CS: clap::Subcommand, S: clap::Args, C>(
) -> anyhow::Result<Init<CS, S, C>>
where
C: Default
+ Append
+ Merge
+ Serialize
+ DeserializeOwned
+ Debug

View File

@@ -10,7 +10,7 @@ use bdk_chain::{
indexer::keychain_txout,
local_chain::{self, LocalChain},
spk_client::{FullScanRequest, SyncRequest},
Append, ConfirmationHeightAnchor,
ConfirmationHeightAnchor, Merge,
};
use bdk_electrum::{
electrum_client::{self, Client, ElectrumApi},
@@ -343,9 +343,9 @@ fn main() -> anyhow::Result<()> {
indexed_tx_graph::ChangeSet::<ConfirmationHeightAnchor, _>::default();
if let Some(keychain_update) = keychain_update {
let keychain_changeset = graph.index.reveal_to_target_multi(&keychain_update);
indexed_tx_graph_changeset.append(keychain_changeset.into());
indexed_tx_graph_changeset.merge(keychain_changeset.into());
}
indexed_tx_graph_changeset.append(graph.apply_update(graph_update));
indexed_tx_graph_changeset.merge(graph.apply_update(graph_update));
(chain_changeset, indexed_tx_graph_changeset)
};

View File

@@ -10,7 +10,7 @@ use bdk_chain::{
indexer::keychain_txout,
local_chain::{self, LocalChain},
spk_client::{FullScanRequest, SyncRequest},
Append, ConfirmationTimeHeightAnchor,
ConfirmationTimeHeightAnchor, Merge,
};
use bdk_esplora::{esplora_client, EsploraExt};
@@ -208,7 +208,7 @@ fn main() -> anyhow::Result<()> {
.index
.reveal_to_target_multi(&update.last_active_indices);
let mut indexed_tx_graph_changeset = graph.apply_update(update.graph_update);
indexed_tx_graph_changeset.append(index_changeset.into());
indexed_tx_graph_changeset.merge(index_changeset.into());
indexed_tx_graph_changeset
})
}