core: optimize CalculateClaimable()
Because accumulated system fee is stored for every block, it is easy to calculate sum with just to reads.
This commit is contained in:
parent
258d8be1dd
commit
1b9968df67
2 changed files with 6 additions and 16 deletions
|
@ -178,12 +178,9 @@ func TestGetTransaction(t *testing.T) {
|
|||
func TestGetClaimable(t *testing.T) {
|
||||
bc := newTestChain(t)
|
||||
|
||||
_, _, err := bc.CalculateClaimable(util.Fixed8FromInt64(1), 0, 2)
|
||||
require.Error(t, err)
|
||||
|
||||
bc.generationAmount = []int{4, 3, 2, 1}
|
||||
bc.decrementInterval = 2
|
||||
_, err = bc.genBlocks(10)
|
||||
_, err := bc.genBlocks(10)
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Run("first generation period", func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue