File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -693,6 +693,25 @@ 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) = self . calculate_fee ( tx) {
699+ if let Ok ( conflicting_fee) = self . calculate_fee ( & conflicting_tx) {
700+ let fee_rate = fee as f32 / tx. weight ( ) . to_vbytes_ceil ( ) as f32 ;
701+ let conflicting_fee_rate = conflicting_fee as f32
702+ / conflicting_tx. weight ( ) . to_vbytes_ceil ( ) as f32 ;
703+
704+ if conflicting_fee > fee && conflicting_fee_rate > fee_rate {
705+ return Ok ( None ) ;
706+ }
707+ }
708+ }
709+ // If fee rates cannot be distinguished, then conflicting tx has priority if txid of
710+ // conflicting tx > txid of original tx
711+ else if conflicting_tx. txid ( ) > tx. txid ( ) {
712+ return Ok ( None ) ;
713+ }
714+ }
696715 }
697716
698717 Ok ( Some ( ChainPosition :: Unconfirmed ( * last_seen) ) )
You can’t perform that action at this time.
0 commit comments