From 4ac45f0930a4a218425176d7b37d87e48a8f9305 Mon Sep 17 00:00:00 2001 From: Luke Van Seters Date: Mon, 6 Dec 2021 14:26:29 -0500 Subject: [PATCH] Don't include a sandwich without filling --- mev_inspect/sandwiches.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/mev_inspect/sandwiches.py b/mev_inspect/sandwiches.py index 456fc9b..0e5c8c9 100644 --- a/mev_inspect/sandwiches.py +++ b/mev_inspect/sandwiches.py @@ -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_transaction_hash=front_swap.transaction_hash, - backrun_transaction_hash=other_swap.transaction_hash, - sandwiched_swaps=sandwiched_swaps, - ) + if len(sandwiched_swaps) > 0: + return Sandwich( + block_number=front_swap.block_number, + sandwicher_address=sandwicher_address, + frontrun_transaction_hash=front_swap.transaction_hash, + backrun_transaction_hash=other_swap.transaction_hash, + sandwiched_swaps=sandwiched_swaps, + ) return None