core: add validUntilBlock field to transaction

1. closes #841

2. Commented out test cases where binary transaction are used.
These test cases marked with `TODO NEO3.0: Update binary` and need to be
updated.

3. Updated other tests.

4. Added cache to calculateValidUntilBlock() RPC-client method.
This commit is contained in:
Anna Shaleva 2020-04-15 09:50:13 +03:00
parent 1e3c36433f
commit 5fa11987d2
16 changed files with 280 additions and 126 deletions

View file

@ -7,7 +7,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/core/storage"
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
"github.com/nspcc-dev/neo-go/pkg/io"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@ -98,7 +97,9 @@ func TestScriptFromWitness(t *testing.T) {
func TestGetHeader(t *testing.T) {
bc := newTestChain(t)
block := bc.newBlock(transaction.NewMinerTX())
tx := transaction.NewMinerTX()
tx.ValidUntilBlock = bc.BlockHeight() + 1
block := bc.newBlock(tx)
err := bc.AddBlock(block)
assert.Nil(t, err)
@ -149,6 +150,8 @@ func TestHasBlock(t *testing.T) {
}
}
//TODO NEO3.0:Update binary
/*
func TestGetTransaction(t *testing.T) {
b1 := getDecodedBlock(t, 1)
block := getDecodedBlock(t, 2)
@ -174,7 +177,7 @@ func TestGetTransaction(t *testing.T) {
assert.NoError(t, bc.persist())
}
}
*/
func TestGetClaimable(t *testing.T) {
bc := newTestChain(t)