File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -790,6 +790,23 @@ impl<A: Anchor> TxGraph<A> {
790790 return Ok ( None ) ;
791791 }
792792 }
793+ if conflicting_tx. last_seen_unconfirmed == * last_seen {
794+ // Check if conflicting tx has higher absolute fee and fee rate
795+ if let ( Ok ( fee) , Ok ( conflicting_fee) ) =
796+ ( self . calculate_fee ( tx) , self . calculate_fee ( & conflicting_tx) )
797+ {
798+ let fee_rate = fee as f32 / tx. weight ( ) . to_vbytes_ceil ( ) as f32 ;
799+ let conflicting_fee_rate =
800+ conflicting_fee as f32 / conflicting_tx. weight ( ) . to_vbytes_ceil ( ) as f32 ;
801+ if conflicting_fee > fee && conflicting_fee_rate > fee_rate {
802+ return Ok ( None ) ;
803+ }
804+ } else if conflicting_tx. txid ( ) > tx. txid ( ) {
805+ // If fee rates cannot be distinguished, then conflicting tx has priority if
806+ // txid of conflicting tx > txid of original tx
807+ return Ok ( None ) ;
808+ }
809+ }
793810 }
794811
795812 Ok ( Some ( ChainPosition :: Unconfirmed ( * last_seen) ) )
You can’t perform that action at this time.
0 commit comments