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