This commit is contained in:
Jae Kwon 2015-07-15 20:04:11 -07:00
parent 9e2b138c35
commit 198d7b9c6f
1 changed files with 6 additions and 3 deletions

View File

@ -750,9 +750,12 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
return types.ErrTxInvalidSignature
}
// tx.Height must be equal to the next height
if tx.Height != _s.LastBlockHeight+1 {
return errors.New(Fmt("Invalid rebond height. Expected %v, got %v", _s.LastBlockHeight+1, tx.Height))
// tx.Height must be in a suitable range
minRebondHeight := _s.LastBlockHeight - (validatorTimeoutBlocks / 2)
maxRebondHeight := _s.LastBlockHeight + 2
if !((minRebondHeight <= tx.Height) && (tx.Height <= maxRebondHeight)) {
return errors.New(Fmt("Rebond height not in range. Expected %v <= %v <= %v",
minRebondHeight, tx.Height, maxRebondHeight))
}
// Good!