Don't include a sandwich without filling

This commit is contained in:
Luke Van Seters 2021-12-06 14:26:29 -05:00
parent d4e8046947
commit 4ac45f0930

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.token_in_address == front_swap.token_out_address
and other_swap.from_address == sandwicher_address and other_swap.from_address == sandwicher_address
): ):
return Sandwich( if len(sandwiched_swaps) > 0:
block_number=front_swap.block_number, return Sandwich(
sandwicher_address=sandwicher_address, block_number=front_swap.block_number,
frontrun_transaction_hash=front_swap.transaction_hash, sandwicher_address=sandwicher_address,
backrun_transaction_hash=other_swap.transaction_hash, frontrun_transaction_hash=front_swap.transaction_hash,
sandwiched_swaps=sandwiched_swaps, backrun_transaction_hash=other_swap.transaction_hash,
) sandwiched_swaps=sandwiched_swaps,
)
return None return None