From f8c202e4be5c4fe1e72a364dd5c7631642bb6da7 Mon Sep 17 00:00:00 2001 From: Dan Laine Date: Mon, 8 Jun 2020 17:11:53 -0400 Subject: [PATCH] don't mark blocks with advanceTimeTxs as rejected if the tx fails verification --- vms/platformvm/proposal_block.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/vms/platformvm/proposal_block.go b/vms/platformvm/proposal_block.go index 2eb85bb..d38d461 100644 --- a/vms/platformvm/proposal_block.go +++ b/vms/platformvm/proposal_block.go @@ -109,13 +109,22 @@ func (pb *ProposalBlock) Verify() error { // pdb is the database if this block's parent is accepted pdb := parent.onAccept() + isAdvanceTimeProposal := false + switch pb.Tx.(type) { + case *advanceTimeTx: + isAdvanceTimeProposal = true + } var err error pb.onCommitDB, pb.onAbortDB, pb.onCommitFunc, pb.onAbortFunc, err = pb.Tx.SemanticVerify(pdb) if err != nil { - if err := pb.Reject(); err == nil { - pb.vm.DB.Commit() - } else { - pb.vm.DB.Abort() + // If this block's transaction proposes to advance the timestamp, the transaction may fail + // verification now but be valid in the future, so don't (permanently) mark the block as rejected. + if !isAdvanceTimeProposal { + if err := pb.Reject(); err == nil { + pb.vm.DB.Commit() + } else { + pb.vm.DB.Abort() + } } return err }