@@ -760,7 +760,7 @@ async def validate_spend_bundle(
760
760
761
761
if fail_reason is Err .MEMPOOL_CONFLICT :
762
762
log .debug (f"Replace attempted. number of MempoolItems: { len (conflicts )} " )
763
- if not can_replace (conflicts , removal_names , potential ):
763
+ if not can_replace (conflicts , potential ):
764
764
return Err .MEMPOOL_CONFLICT , potential , []
765
765
766
766
duration = time .monotonic () - start_time
@@ -1020,17 +1020,12 @@ def optional_max(a: Optional[T], b: Optional[T]) -> Optional[T]:
1020
1020
return max ((v for v in [a , b ] if v is not None ), default = None )
1021
1021
1022
1022
1023
- def can_replace (
1024
- conflicting_items : list [MempoolItem ],
1025
- removal_names : set [bytes32 ],
1026
- new_item : MempoolItem ,
1027
- ) -> bool :
1023
+ def can_replace (conflicting_items : list [MempoolItem ], new_item : MempoolItem ) -> bool :
1028
1024
"""
1029
1025
This function implements the mempool replacement rules. Given a Mempool item
1030
1026
we're attempting to insert into the mempool (new_item) and the set of existing
1031
1027
mempool items that conflict with it, this function answers the question whether
1032
- the existing items can be replaced by the new one. The removals parameter are
1033
- the coin IDs the new mempool item is spending.
1028
+ the existing items can be replaced by the new one.
1034
1029
"""
1035
1030
1036
1031
conflicting_fees = 0
@@ -1055,7 +1050,7 @@ def can_replace(
1055
1050
# fee than AB therefore kicking out A altogether. The better way to solve this would be to keep a cache
1056
1051
# of booted transactions like A, and retry them after they get removed from mempool due to a conflict.
1057
1052
for coin_id , bcs in item .bundle_coin_spends .items ():
1058
- if coin_id not in removal_names :
1053
+ if coin_id not in new_item . bundle_coin_spends :
1059
1054
log .debug ("Rejecting conflicting tx as it does not spend conflicting coin %s" , coin_id )
1060
1055
return False
1061
1056
if bcs .supports_fast_forward :
0 commit comments