Merge pull request #170 from flashbots/no-sandwiches

If no sandwiched swaps, not a sandwich
This commit is contained in:
Luke Van Seters 2021-12-17 12:15:05 -05:00 committed by GitHub
commit cfa3443f88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,12 +48,13 @@ def _get_sandwich_starting_with_swap(
and other_swap.token_in_address == front_swap.token_out_address
and other_swap.from_address == sandwicher_address
):
return Sandwich(
block_number=front_swap.block_number,
sandwicher_address=sandwicher_address,
frontrun_swap=front_swap,
backrun_swap=other_swap,
sandwiched_swaps=sandwiched_swaps,
)
if len(sandwiched_swaps) > 0:
return Sandwich(
block_number=front_swap.block_number,
sandwicher_address=sandwicher_address,
frontrun_swap=front_swap,
backrun_swap=other_swap,
sandwiched_swaps=sandwiched_swaps,
)
return None