mirror of https://github.com/poanetwork/gecko.git
don't mark blocks with advanceTimeTxs as rejected if the tx fails verification
This commit is contained in:
parent
c86838f2e8
commit
f8c202e4be
|
@ -109,14 +109,23 @@ func (pb *ProposalBlock) Verify() error {
|
||||||
// pdb is the database if this block's parent is accepted
|
// pdb is the database if this block's parent is accepted
|
||||||
pdb := parent.onAccept()
|
pdb := parent.onAccept()
|
||||||
|
|
||||||
|
isAdvanceTimeProposal := false
|
||||||
|
switch pb.Tx.(type) {
|
||||||
|
case *advanceTimeTx:
|
||||||
|
isAdvanceTimeProposal = true
|
||||||
|
}
|
||||||
var err error
|
var err error
|
||||||
pb.onCommitDB, pb.onAbortDB, pb.onCommitFunc, pb.onAbortFunc, err = pb.Tx.SemanticVerify(pdb)
|
pb.onCommitDB, pb.onAbortDB, pb.onCommitFunc, pb.onAbortFunc, err = pb.Tx.SemanticVerify(pdb)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// 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 {
|
if err := pb.Reject(); err == nil {
|
||||||
pb.vm.DB.Commit()
|
pb.vm.DB.Commit()
|
||||||
} else {
|
} else {
|
||||||
pb.vm.DB.Abort()
|
pb.vm.DB.Abort()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue