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:
parent
1e3c36433f
commit
5fa11987d2
16 changed files with 280 additions and 126 deletions
|
@ -1340,6 +1340,10 @@ func (bc *Blockchain) verifyHeader(currHeader, prevHeader *block.Header) error {
|
|||
|
||||
// verifyTx verifies whether a transaction is bonafide or not.
|
||||
func (bc *Blockchain) verifyTx(t *transaction.Transaction, block *block.Block) error {
|
||||
height := bc.BlockHeight()
|
||||
if t.ValidUntilBlock <= height || t.ValidUntilBlock > height+transaction.MaxValidUntilBlockIncrement {
|
||||
return errors.Errorf("transaction has expired. ValidUntilBlock = %d, current height = %d", t.ValidUntilBlock, height)
|
||||
}
|
||||
if io.GetVarSize(t) > transaction.MaxTransactionSize {
|
||||
return errors.Errorf("invalid transaction size = %d. It shoud be less then MaxTransactionSize = %d", io.GetVarSize(t), transaction.MaxTransactionSize)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue