mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-12 11:10:35 +00:00
Merge pull request #1386 from nspcc-dev/fix-neo-utxo-tracking
core: fix NEO UTXO tracking, drop Fixed8 multiplier
This commit is contained in:
commit
04ebef9119
2 changed files with 9 additions and 4 deletions
|
@ -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(),
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue