aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus-core/core/interfaces.go2
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus-core/core/lattice.go3
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus-core/core/nonblocking.go2
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus-core/core/types/block.go14
4 files changed, 18 insertions, 3 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus-core/core/interfaces.go b/vendor/github.com/dexon-foundation/dexon-consensus-core/core/interfaces.go
index 7b985cf7a..2ba8e0d3a 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus-core/core/interfaces.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus-core/core/interfaces.go
@@ -35,7 +35,7 @@ type Application interface {
PrepareWitness(consensusHeight uint64) (types.Witness, error)
// VerifyBlock verifies if the block is valid.
- VerifyBlock(block *types.Block) bool
+ VerifyBlock(block *types.Block) types.BlockVerifyStatus
// BlockConfirmed is called when a block is confirmed and added to lattice.
BlockConfirmed(block types.Block)
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus-core/core/lattice.go b/vendor/github.com/dexon-foundation/dexon-consensus-core/core/lattice.go
index 984203d7d..0357a8d99 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus-core/core/lattice.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus-core/core/lattice.go
@@ -136,7 +136,8 @@ func (s *Lattice) SanityCheck(b *types.Block, checkRelation bool) (err error) {
}
// Verify data in application layer.
s.logger.Debug("Calling Application.VerifyBlock", "block", b)
- if !s.app.VerifyBlock(b) {
+ // TODO(jimmy-dexon): handle types.VerifyRetryLater.
+ if s.app.VerifyBlock(b) == types.VerifyInvalidBlock {
err = ErrInvalidBlock
return err
}
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus-core/core/nonblocking.go b/vendor/github.com/dexon-foundation/dexon-consensus-core/core/nonblocking.go
index 675675b2f..36135fdd9 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus-core/core/nonblocking.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus-core/core/nonblocking.go
@@ -129,7 +129,7 @@ func (nb *nonBlocking) PrepareWitness(height uint64) (types.Witness, error) {
}
// VerifyBlock cannot be non-blocking.
-func (nb *nonBlocking) VerifyBlock(block *types.Block) bool {
+func (nb *nonBlocking) VerifyBlock(block *types.Block) types.BlockVerifyStatus {
return nb.app.VerifyBlock(block)
}
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus-core/core/types/block.go b/vendor/github.com/dexon-foundation/dexon-consensus-core/core/types/block.go
index 9de467397..29b1c841f 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus-core/core/types/block.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus-core/core/types/block.go
@@ -33,6 +33,20 @@ import (
"github.com/dexon-foundation/dexon-consensus-core/core/crypto"
)
+// BlockVerifyStatus is the return code for core.Application.VerifyBlock
+type BlockVerifyStatus int
+
+// Enums for return value of core.Application.VerifyBlock.
+const (
+ // VerifyOK: Block is verified.
+ VerifyOK BlockVerifyStatus = iota
+ // VerifyRetryLater: Block is unable to be verified at this moment.
+ // Try again later.
+ VerifyRetryLater
+ // VerifyInvalidBlock: Block is an invalid one.
+ VerifyInvalidBlock
+)
+
var (
// blockPool is the blocks cache to reuse allocated blocks.
blockPool = sync.Pool{