From ebc215945614b6c16a16254a10c5c9a7dbbf589f Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Fri, 5 Jul 2024 21:08:47 -0400 Subject: [PATCH] zero state on decision --- vms/example/xsvm/chain/block.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/vms/example/xsvm/chain/block.go b/vms/example/xsvm/chain/block.go index bac28c9317c0..e56e49e327ce 100644 --- a/vms/example/xsvm/chain/block.go +++ b/vms/example/xsvm/chain/block.go @@ -101,11 +101,13 @@ func (b *block) Accept(context.Context) error { b.chain.lastAcceptedID = b.id b.chain.lastAcceptedHeight = b.Height() delete(b.chain.verifiedBlocks, b.ParentID) + b.state = nil return nil } func (b *block) Reject(context.Context) error { delete(b.chain.verifiedBlocks, b.id) + b.state = nil // TODO: push transactions back into the mempool return nil @@ -171,12 +173,8 @@ func (b *block) State() (database.Database, error) { return b.chain.acceptedState, nil } - // States of accepted blocks other than the lastAccepted are undefined. - if b.Height() <= b.chain.lastAcceptedHeight { - return nil, errMissingState - } - - // We should not be calling State on an unverified block. + // If this block isn't processing, then the child should never have had + // verify called on it. if b.state == nil { return nil, errParentNotVerified }