@@ -482,7 +482,7 @@ impl<A: Clone + Ord> TxGraph<A> {
482482
483483 /// Applies [`Additions`] to [`TxGraph`].
484484 pub fn apply_additions ( & mut self , additions : Additions < A > ) {
485- for tx in additions. tx {
485+ for tx in additions. txs {
486486 let txid = tx. txid ( ) ;
487487
488488 tx. input
@@ -513,7 +513,7 @@ impl<A: Clone + Ord> TxGraph<A> {
513513 }
514514 }
515515
516- for ( outpoint, txout) in additions. txout {
516+ for ( outpoint, txout) in additions. txouts {
517517 let tx_entry = self
518518 . txs
519519 . entry ( outpoint. txid )
@@ -553,11 +553,11 @@ impl<A: Clone + Ord> TxGraph<A> {
553553 for ( & txid, ( update_tx_node, _, update_last_seen) ) in & update. txs {
554554 let prev_last_seen: u64 = match ( self . txs . get ( & txid) , update_tx_node) {
555555 ( None , TxNodeInternal :: Whole ( update_tx) ) => {
556- additions. tx . insert ( update_tx. clone ( ) ) ;
556+ additions. txs . insert ( update_tx. clone ( ) ) ;
557557 0
558558 }
559559 ( None , TxNodeInternal :: Partial ( update_txos) ) => {
560- additions. txout . extend (
560+ additions. txouts . extend (
561561 update_txos
562562 . iter ( )
563563 . map ( |( & vout, txo) | ( OutPoint :: new ( txid, vout) , txo. clone ( ) ) ) ,
@@ -569,14 +569,14 @@ impl<A: Clone + Ord> TxGraph<A> {
569569 Some ( ( TxNodeInternal :: Partial ( _) , _, last_seen) ) ,
570570 TxNodeInternal :: Whole ( update_tx) ,
571571 ) => {
572- additions. tx . insert ( update_tx. clone ( ) ) ;
572+ additions. txs . insert ( update_tx. clone ( ) ) ;
573573 * last_seen
574574 }
575575 (
576576 Some ( ( TxNodeInternal :: Partial ( txos) , _, last_seen) ) ,
577577 TxNodeInternal :: Partial ( update_txos) ,
578578 ) => {
579- additions. txout . extend (
579+ additions. txouts . extend (
580580 update_txos
581581 . iter ( )
582582 . filter ( |( vout, _) | !txos. contains_key ( * vout) )
@@ -983,17 +983,17 @@ impl<A: Anchor> TxGraph<A> {
983983) ]
984984#[ must_use]
985985pub struct Additions < A = ( ) > {
986- pub tx : BTreeSet < Transaction > ,
987- pub txout : BTreeMap < OutPoint , TxOut > ,
986+ pub txs : BTreeSet < Transaction > ,
987+ pub txouts : BTreeMap < OutPoint , TxOut > ,
988988 pub anchors : BTreeSet < ( A , Txid ) > ,
989989 pub last_seen : BTreeMap < Txid , u64 > ,
990990}
991991
992992impl < A > Default for Additions < A > {
993993 fn default ( ) -> Self {
994994 Self {
995- tx : Default :: default ( ) ,
996- txout : Default :: default ( ) ,
995+ txs : Default :: default ( ) ,
996+ txouts : Default :: default ( ) ,
997997 anchors : Default :: default ( ) ,
998998 last_seen : Default :: default ( ) ,
999999 }
@@ -1003,27 +1003,27 @@ impl<A> Default for Additions<A> {
10031003impl < A > Additions < A > {
10041004 /// Returns true if the [`Additions`] is empty (no transactions or txouts).
10051005 pub fn is_empty ( & self ) -> bool {
1006- self . tx . is_empty ( ) && self . txout . is_empty ( )
1006+ self . txs . is_empty ( ) && self . txouts . is_empty ( )
10071007 }
10081008
10091009 /// Iterates over all outpoints contained within [`Additions`].
10101010 pub fn txouts ( & self ) -> impl Iterator < Item = ( OutPoint , & TxOut ) > {
1011- self . tx
1011+ self . txs
10121012 . iter ( )
10131013 . flat_map ( |tx| {
10141014 tx. output
10151015 . iter ( )
10161016 . enumerate ( )
10171017 . map ( move |( vout, txout) | ( OutPoint :: new ( tx. txid ( ) , vout as _ ) , txout) )
10181018 } )
1019- . chain ( self . txout . iter ( ) . map ( |( op, txout) | ( * op, txout) ) )
1019+ . chain ( self . txouts . iter ( ) . map ( |( op, txout) | ( * op, txout) ) )
10201020 }
10211021}
10221022
10231023impl < A : Ord > Append for Additions < A > {
10241024 fn append ( & mut self , mut other : Self ) {
1025- self . tx . append ( & mut other. tx ) ;
1026- self . txout . append ( & mut other. txout ) ;
1025+ self . txs . append ( & mut other. txs ) ;
1026+ self . txouts . append ( & mut other. txouts ) ;
10271027 self . anchors . append ( & mut other. anchors ) ;
10281028
10291029 // last_seen timestamps should only increase
@@ -1037,8 +1037,8 @@ impl<A: Ord> Append for Additions<A> {
10371037 }
10381038
10391039 fn is_empty ( & self ) -> bool {
1040- self . tx . is_empty ( )
1041- && self . txout . is_empty ( )
1040+ self . txs . is_empty ( )
1041+ && self . txouts . is_empty ( )
10421042 && self . anchors . is_empty ( )
10431043 && self . last_seen . is_empty ( )
10441044 }
0 commit comments