aboutsummaryrefslogtreecommitdiffstats
path: root/core/lattice.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/lattice.go')
-rw-r--r--core/lattice.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/lattice.go b/core/lattice.go
index ea5286d..a0028a7 100644
--- a/core/lattice.go
+++ b/core/lattice.go
@@ -86,11 +86,12 @@ func (s *Lattice) PrepareBlock(
return
}
-// SanityCheck check if a block is valid based on current lattice status.
+// SanityCheck check if a block is valid.
+// If checkRelation is true, it also checks with current lattice status.
//
// If some acking blocks don't exists, Lattice would help to cache this block
// and retry when lattice updated in Lattice.ProcessBlock.
-func (s *Lattice) SanityCheck(b *types.Block) (err error) {
+func (s *Lattice) SanityCheck(b *types.Block, checkRelation bool) (err error) {
// Verify block's signature.
if err = s.authModule.VerifyBlock(b); err != nil {
return
@@ -110,6 +111,9 @@ func (s *Lattice) SanityCheck(b *types.Block) (err error) {
err = ErrInvalidBlock
return err
}
+ if !checkRelation {
+ return
+ }
s.lock.RLock()
defer s.lock.RUnlock()
if err = s.data.sanityCheck(b); err != nil {