From bf6525e54db082d9acbd2464aea9eb4c9a897084 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 27 May 2020 22:55:40 +0300 Subject: [PATCH] core: fix GetUtilityTokenBalance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The value stored in NEP5 tracker for GAS is Fixed8 already, so we need to type-cast it, but not multiply by 10⁸ again. --- pkg/core/blockchain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 7155b7734..3a0ff5371 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -927,7 +927,7 @@ func (bc *Blockchain) GetNEP5Balances(acc util.Uint160) *state.NEP5Balances { // GetUtilityTokenBalance returns utility token (GAS) balance for the acc. func (bc *Blockchain) GetUtilityTokenBalance(acc util.Uint160) util.Fixed8 { - return util.Fixed8FromInt64(bc.GetNEP5Balances(acc).Trackers[bc.contracts.GAS.Hash].Balance) + return util.Fixed8(bc.GetNEP5Balances(acc).Trackers[bc.contracts.GAS.Hash].Balance) } // LastBatch returns last persisted storage batch.