aboutsummaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
authorBojie Wu <bojie@dexon.org>2018-10-09 13:28:45 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:16 +0800
commitbc2cfaa5cec22740b0f61a09fc129235eadc2134 (patch)
tree69cd72cb25bf45aa2e9e019732ddca725b7be165 /vendor
parent44ce26cb076c5852167c1ffc9eceff9148ee5477 (diff)
downloadgo-tangerine-bc2cfaa5cec22740b0f61a09fc129235eadc2134.tar
go-tangerine-bc2cfaa5cec22740b0f61a09fc129235eadc2134.tar.gz
go-tangerine-bc2cfaa5cec22740b0f61a09fc129235eadc2134.tar.bz2
go-tangerine-bc2cfaa5cec22740b0f61a09fc129235eadc2134.tar.lz
go-tangerine-bc2cfaa5cec22740b0f61a09fc129235eadc2134.tar.xz
go-tangerine-bc2cfaa5cec22740b0f61a09fc129235eadc2134.tar.zst
go-tangerine-bc2cfaa5cec22740b0f61a09fc129235eadc2134.zip
app: correct process pending block logic
Diffstat (limited to 'vendor')
-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
-rw-r--r--vendor/vendor.json32
5 files changed, 34 insertions, 19 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{
diff --git a/vendor/vendor.json b/vendor/vendor.json
index f2c472262..e0fd8cc5c 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -105,44 +105,44 @@
{
"checksumSHA1": "IKOLx0ZjJoT9x9zO/bVAXWcNXs8=",
"path": "github.com/dexon-foundation/dexon-consensus-core/common",
- "revision": "d6a321f8f3a67af251f2ab1f8a52f1aaab629387",
- "revisionTime": "2018-10-23T07:29:58Z"
+ "revision": "83c4f24de2aa8f13f6b97c06aa29f204b4fc2f8b",
+ "revisionTime": "2018-10-23T09:14:47Z"
},
{
- "checksumSHA1": "MALFN2XbuWHClEnqeZtgV8sIO5Y=",
+ "checksumSHA1": "rcPl7V6DiiKQCvkX/h6THwOAGoc=",
"path": "github.com/dexon-foundation/dexon-consensus-core/core",
- "revision": "d6a321f8f3a67af251f2ab1f8a52f1aaab629387",
- "revisionTime": "2018-10-23T07:29:58Z"
+ "revision": "83c4f24de2aa8f13f6b97c06aa29f204b4fc2f8b",
+ "revisionTime": "2018-10-23T09:14:47Z"
},
{
"checksumSHA1": "69/j3ROwzhdGPWKymJnGjaJ5QzY=",
"path": "github.com/dexon-foundation/dexon-consensus-core/core/blockdb",
- "revision": "d6a321f8f3a67af251f2ab1f8a52f1aaab629387",
- "revisionTime": "2018-10-23T07:29:58Z"
+ "revision": "83c4f24de2aa8f13f6b97c06aa29f204b4fc2f8b",
+ "revisionTime": "2018-10-23T09:14:47Z"
},
{
"checksumSHA1": "GXHmtn3UlUftllBXI+M8RBkilzY=",
"path": "github.com/dexon-foundation/dexon-consensus-core/core/crypto",
- "revision": "d6a321f8f3a67af251f2ab1f8a52f1aaab629387",
- "revisionTime": "2018-10-23T07:29:58Z"
+ "revision": "83c4f24de2aa8f13f6b97c06aa29f204b4fc2f8b",
+ "revisionTime": "2018-10-23T09:14:47Z"
},
{
"checksumSHA1": "sh19Kk6G7esEcBPC2QsaFF3V/Ds=",
"path": "github.com/dexon-foundation/dexon-consensus-core/core/crypto/dkg",
- "revision": "d6a321f8f3a67af251f2ab1f8a52f1aaab629387",
- "revisionTime": "2018-10-23T07:29:58Z"
+ "revision": "83c4f24de2aa8f13f6b97c06aa29f204b4fc2f8b",
+ "revisionTime": "2018-10-23T09:14:47Z"
},
{
"checksumSHA1": "priVCcv7H4LTooiN/1EUu8qFiSs=",
"path": "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa",
- "revision": "d6a321f8f3a67af251f2ab1f8a52f1aaab629387",
- "revisionTime": "2018-10-23T07:29:58Z"
+ "revision": "83c4f24de2aa8f13f6b97c06aa29f204b4fc2f8b",
+ "revisionTime": "2018-10-23T09:14:47Z"
},
{
- "checksumSHA1": "ILGM5rnuCywK3Z6e6fs1ns9CUx0=",
+ "checksumSHA1": "dKIKJdmVmYKd1ihBAfEoOn6qeCc=",
"path": "github.com/dexon-foundation/dexon-consensus-core/core/types",
- "revision": "d6a321f8f3a67af251f2ab1f8a52f1aaab629387",
- "revisionTime": "2018-10-23T07:29:58Z"
+ "revision": "83c4f24de2aa8f13f6b97c06aa29f204b4fc2f8b",
+ "revisionTime": "2018-10-23T09:14:47Z"
},
{
"checksumSHA1": "TAkwduKZqLyimyTPPWIllZWYFuE=",