From 9e9d59b49a5107626ee6e5a2c02be3364f3f293e Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 28 Feb 2020 11:49:14 +0300 Subject: [PATCH] core: set NetworkFee to 0 for Claim and Miner transactions Claim tx have no GAS inputs and a positive output which can lead to negative network fee. --- pkg/core/blockchain.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index a7d8c0f5b..b8a53c393 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -1168,6 +1168,11 @@ func (bc *Blockchain) FeePerByte(t *transaction.Transaction) util.Fixed8 { // NetworkFee returns network fee. func (bc *Blockchain) NetworkFee(t *transaction.Transaction) util.Fixed8 { + // https://github.com/neo-project/neo/blob/master-2.x/neo/Network/P2P/Payloads/ClaimTransaction.cs#L16 + if t.Type == transaction.ClaimType || t.Type == transaction.MinerType { + return 0 + } + inputAmount := util.Fixed8FromInt64(0) refs, err := bc.References(t) if err != nil {