From 15aeef09fbb2a7629fe59aa9471e4c9d1a740268 Mon Sep 17 00:00:00 2001
From: Jaynti Kanani <jdkanani@gmail.com>
Date: Mon, 21 Oct 2019 19:07:02 +0530
Subject: [PATCH] add fees log if fees > 0

---
 core/state_transition.go | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/core/state_transition.go b/core/state_transition.go
index 6272619a0..0d79923f2 100644
--- a/core/state_transition.go
+++ b/core/state_transition.go
@@ -35,6 +35,7 @@ var (
 var transferLogSig = common.HexToHash("0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4")
 var transferFeeLogSig = common.HexToHash("0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63")
 var feeAddress = common.HexToAddress("0x0000000000000000000000000000000000001010")
+var bigZero = big.NewInt(0)
 
 /*
 The State Transitioning Model
@@ -237,18 +238,20 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo
 	output2 := new(big.Int).SetBytes(input2.Bytes())
 
 	// add transfer log
-	AddFeeTransferLog(
-		st.state,
-
-		msg.From(),
-		st.evm.Coinbase,
-
-		amount,
-		input1,
-		input2,
-		output1.Sub(output1, amount),
-		output2.Add(output2, amount),
-	)
+	if amount.Cmp(bigZero) > 0 {
+		AddFeeTransferLog(
+			st.state,
+
+			msg.From(),
+			st.evm.Coinbase,
+
+			amount,
+			input1,
+			input2,
+			output1.Sub(output1, amount),
+			output2.Add(output2, amount),
+		)
+	}
 
 	return ret, st.gasUsed(), vmerr != nil, err
 }
-- 
GitLab