core: fix CalculateClaimable for NEP5 NEO
It's not stored as Fixed8, so calculations need to be adjusted for that.
This commit is contained in:
parent
39dfebccc4
commit
3d18f09def
7 changed files with 28 additions and 18 deletions
|
@ -194,22 +194,22 @@ func TestGetClaimable(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
t.Run("first generation period", func(t *testing.T) {
|
||||
amount := bc.CalculateClaimable(util.Fixed8FromInt64(1), 0, 2)
|
||||
amount := bc.CalculateClaimable(1, 0, 2)
|
||||
require.EqualValues(t, 8, amount)
|
||||
})
|
||||
|
||||
t.Run("a number of full periods", func(t *testing.T) {
|
||||
amount := bc.CalculateClaimable(util.Fixed8FromInt64(1), 0, 6)
|
||||
amount := bc.CalculateClaimable(1, 0, 6)
|
||||
require.EqualValues(t, 4+4+3+3+2+2, amount)
|
||||
})
|
||||
|
||||
t.Run("start from the 2-nd block", func(t *testing.T) {
|
||||
amount := bc.CalculateClaimable(util.Fixed8FromInt64(1), 1, 7)
|
||||
amount := bc.CalculateClaimable(1, 1, 7)
|
||||
require.EqualValues(t, 4+3+3+2+2+1, amount)
|
||||
})
|
||||
|
||||
t.Run("end height after generation has ended", func(t *testing.T) {
|
||||
amount := bc.CalculateClaimable(util.Fixed8FromInt64(1), 1, 10)
|
||||
amount := bc.CalculateClaimable(1, 1, 10)
|
||||
require.EqualValues(t, 4+3+3+2+2+1+1, amount)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue