From 9fbf63f4a6ebc9fc629acbb84df1a6ee876ec43d Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 30 Oct 2019 16:17:01 +0300 Subject: [PATCH] fix count for a contract --- .../lib/block_scout_web/controllers/address_controller.ex | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex index 8fa02a207c..72f348479c 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex @@ -108,7 +108,13 @@ defmodule BlockScoutWeb.AddressController do defp transaction_count(address) do if contract?(address) do - Chain.address_to_incoming_transaction_count(address.hash) + incoming_transaction_count = Chain.address_to_incoming_transaction_count(address.hash) + + if incoming_transaction_count == 0 do + Chain.total_transactions_sent_by_address(address.hash) + else + incoming_transaction_count + end else Chain.total_transactions_sent_by_address(address.hash) end