From 088c32f52f66449e5d1e72abd6a8b3f17d22d5f4 Mon Sep 17 00:00:00 2001 From: Luke Van Seters Date: Fri, 17 Dec 2021 11:02:03 -0500 Subject: [PATCH] If no sandwiched swaps, not a sandwich --- 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 e455bef..7e23873 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_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