We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
TxGraph::insert_tx
Arc
1 parent 7cb97eb commit 6a97e5eCopy full SHA for 6a97e5e
crates/chain/src/tx_graph.rs
@@ -516,12 +516,12 @@ impl<A: Clone + Ord> TxGraph<A> {
516
/// Inserts the given transaction into [`TxGraph`].
517
///
518
/// The [`ChangeSet`] returned will be empty if `tx` already exists.
519
- pub fn insert_tx(&mut self, tx: Transaction) -> ChangeSet<A> {
+ pub fn insert_tx<T: Into<Arc<Transaction>>>(&mut self, tx: T) -> ChangeSet<A> {
520
+ let tx = tx.into();
521
let mut update = Self::default();
- update.txs.insert(
522
- tx.txid(),
523
- (TxNodeInternal::Whole(tx.into()), BTreeSet::new(), 0),
524
- );
+ update
+ .txs
+ .insert(tx.txid(), (TxNodeInternal::Whole(tx), BTreeSet::new(), 0));
525
self.apply_update(update)
526
}
527
0 commit comments