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.
This commit is contained in:
Evgenii Stratonikov 2020-02-28 11:49:14 +03:00
parent 21ef2638c0
commit 9e9d59b49a

View file

@ -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 {