diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 7cc012b93..2119f22a3 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -933,10 +933,15 @@ func processTransfer(cache *dao.Cached, tx *transaction.Transaction, b *block.Bl if !isGoverning && !out.AssetID.Equals(UtilityTokenID()) { return nil } + var amount = int64(out.Amount) + // NEO has no fractional part and Fixed8 representation is just misleading here. + if isGoverning { + amount = out.Amount.IntegralValue() + } tr := &state.Transfer{ IsGoverning: isGoverning, IsSent: isSent, - Amount: int64(out.Amount), + Amount: amount, Block: b.Index, Timestamp: b.Timestamp, Tx: tx.Hash(), diff --git a/pkg/rpc/server/server_test.go b/pkg/rpc/server/server_test.go index 38109c223..b69a88625 100644 --- a/pkg/rpc/server/server_test.go +++ b/pkg/rpc/server/server_test.go @@ -1288,7 +1288,7 @@ func checkTransfers(t *testing.T, e *executor, acc interface{}, asset string, st u := getUTXOForBlock(res, false, "neo", 1) if start <= 1 && (stop == 0 || stop >= 1) && (asset == "neo" || asset == "") { require.NotNil(t, u) - require.EqualValues(t, int64(util.Fixed8FromInt64(99999000)), u.Amount) + require.EqualValues(t, int64(99999000), u.Amount) } else { require.Nil(t, u) } @@ -1306,7 +1306,7 @@ func checkTransfers(t *testing.T, e *executor, acc interface{}, asset string, st u = getUTXOForBlock(res, true, "neo", 206) if start <= 206 && (stop == 0 || stop >= 206) && (asset == "neo" || asset == "") { require.NotNil(t, u) - require.EqualValues(t, int64(util.Fixed8FromInt64(99999000)), u.Amount) + require.EqualValues(t, int64(99999000), u.Amount) } else { require.Nil(t, u) } @@ -1314,7 +1314,7 @@ func checkTransfers(t *testing.T, e *executor, acc interface{}, asset string, st u = getUTXOForBlock(res, false, "neo", 206) if start <= 206 && (stop == 0 || stop >= 206) && (asset == "neo" || asset == "") { require.NotNil(t, u) - require.EqualValues(t, int64(util.Fixed8FromInt64(99998000)), u.Amount) + require.EqualValues(t, int64(99998000), u.Amount) } else { require.Nil(t, u) }