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 @@ -693,6 +693,23 @@ impl<A: Anchor> TxGraph<A> {
693693 if conflicting_tx. last_seen_unconfirmed > * last_seen {
694694 return Ok ( None ) ;
695695 }
696+ if conflicting_tx. last_seen_unconfirmed == * last_seen {
697+ // Check if conflicting tx has higher absolute fee and fee rate
698+ if let ( Ok ( fee) , Ok ( conflicting_fee) ) =
699+ ( self . calculate_fee ( tx) , self . calculate_fee ( & conflicting_tx) )
700+ {
701+ let fee_rate = fee as f32 / tx. weight ( ) . to_vbytes_ceil ( ) as f32 ;
702+ let conflicting_fee_rate =
703+ conflicting_fee as f32 / conflicting_tx. weight ( ) . to_vbytes_ceil ( ) as f32 ;
704+ if conflicting_fee > fee && conflicting_fee_rate > fee_rate {
705+ return Ok ( None ) ;
706+ }
707+ } else if conflicting_tx. txid ( ) > tx. txid ( ) {
708+ // If fee rates cannot be distinguished, then conflicting tx has priority if
709+ // txid of conflicting tx > txid of original tx
710+ return Ok ( None ) ;
711+ }
712+ }
696713 }
697714
698715 Ok ( Some ( ChainPosition :: Unconfirmed ( * last_seen) ) )
You can’t perform that action at this time.
0 commit comments