From b233158c9fd7df79ae4f5b321fee5d3ad54cdcef Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 5 Nov 2020 22:08:02 +0300 Subject: [PATCH] transaction: lower MaxValidUntilBlockIncrement Follow neo-project/neo#2042. --- pkg/core/blockchain_test.go | 6 +++--- pkg/core/transaction/transaction.go | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/core/blockchain_test.go b/pkg/core/blockchain_test.go index a5c552e3c..463be77ff 100644 --- a/pkg/core/blockchain_test.go +++ b/pkg/core/blockchain_test.go @@ -922,7 +922,7 @@ func TestSubscriptions(t *testing.T) { txGood1 := transaction.New(netmode.UnitTestNet, script.Bytes(), 0) txGood1.Signers = []transaction.Signer{{Account: neoOwner}} txGood1.Nonce = 1 - txGood1.ValidUntilBlock = 100500 + txGood1.ValidUntilBlock = 1024 require.NoError(t, signTx(bc, txGood1)) // Reset() reuses the script buffer and we need to keep scripts. @@ -934,7 +934,7 @@ func TestSubscriptions(t *testing.T) { txBad := transaction.New(netmode.UnitTestNet, script.Bytes(), 0) txBad.Signers = []transaction.Signer{{Account: neoOwner}} txBad.Nonce = 2 - txBad.ValidUntilBlock = 100500 + txBad.ValidUntilBlock = 1024 require.NoError(t, signTx(bc, txBad)) script = io.NewBufBinWriter() @@ -944,7 +944,7 @@ func TestSubscriptions(t *testing.T) { txGood2 := transaction.New(netmode.UnitTestNet, script.Bytes(), 0) txGood2.Signers = []transaction.Signer{{Account: neoOwner}} txGood2.Nonce = 3 - txGood2.ValidUntilBlock = 100500 + txGood2.ValidUntilBlock = 1024 require.NoError(t, signTx(bc, txGood2)) invBlock := newBlock(bc.config, bc.BlockHeight()+1, bc.CurrentHeaderHash(), txGood1, txBad, txGood2) diff --git a/pkg/core/transaction/transaction.go b/pkg/core/transaction/transaction.go index dc1d9abe5..1b82981ec 100644 --- a/pkg/core/transaction/transaction.go +++ b/pkg/core/transaction/transaction.go @@ -20,9 +20,10 @@ const ( // MaxTransactionSize is the upper limit size in bytes that a transaction can reach. It is // set to be 102400. MaxTransactionSize = 102400 - // MaxValidUntilBlockIncrement is the upper increment size of blockhain height in blocs after - // exceeding that a transaction should fail validation. It is set to be 2102400. - MaxValidUntilBlockIncrement = 2102400 + // MaxValidUntilBlockIncrement is the upper increment size of blockhain height in blocks + // exceeding that a transaction should fail validation. It is set to estimated daily number + // of blocks with 15s interval. + MaxValidUntilBlockIncrement = 5760 // MaxAttributes is maximum number of attributes including signers that can be contained // within a transaction. It is set to be 16. MaxAttributes = 16