aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-06 16:53:15 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:22 +0800
commit920c88803eaa5e1c67cd4cef752d9d6f11ccbd02 (patch)
treef654fe7e87154ea8388e3127e7107cf06d9b03c5 /vendor/github.com
parentccb4258f1abdea547e1ae4357c4be14043e315ca (diff)
downloadgo-tangerine-920c88803eaa5e1c67cd4cef752d9d6f11ccbd02.tar.gz
go-tangerine-920c88803eaa5e1c67cd4cef752d9d6f11ccbd02.tar.zst
go-tangerine-920c88803eaa5e1c67cd4cef752d9d6f11ccbd02.zip
vendor: sync to latest core (#225)
Diffstat (limited to 'vendor/github.com')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go12
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go50
2 files changed, 11 insertions, 51 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
index 370df72cf..0f665f29a 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
@@ -891,13 +891,11 @@ MessageLoop:
ch, e := con.baConfirmedBlock[val.Hash]
return ch, e
}(); exist {
- if err := con.bcModule.sanityCheck(val); err != nil {
- if err == ErrRetrySanityCheckLater {
- err = nil
- } else {
- con.logger.Error("SanityCheck failed", "error", err)
- continue MessageLoop
- }
+ if err := utils.VerifyBlockSignature(val); err != nil {
+ con.logger.Error("VerifyBlockSignature failed",
+ "block", val,
+ "error", err)
+ continue MessageLoop
}
func() {
con.lock.Lock()
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go
index e43ebc806..f6b3e0e1b 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go
@@ -138,13 +138,6 @@ type PublicKeyShares struct {
masterPublicKey []bls.PublicKey
}
-type rlpPublicKeyShares struct {
- ShareCaches [][]byte
- ShareCacheIndexK [][]byte
- ShareCacheIndexV []uint32
- MasterPublicKey [][]byte
-}
-
// Equal checks equality of two PublicKeyShares instance.
func (pubs *PublicKeyShares) Equal(other *PublicKeyShares) bool {
// Check shares.
@@ -172,53 +165,22 @@ func (pubs *PublicKeyShares) Equal(other *PublicKeyShares) bool {
// EncodeRLP implements rlp.Encoder
func (pubs *PublicKeyShares) EncodeRLP(w io.Writer) error {
- var rps rlpPublicKeyShares
- for _, share := range pubs.shareCaches {
- rps.ShareCaches = append(rps.ShareCaches, share.Serialize())
+ mpks := make([][]byte, len(pubs.masterPublicKey))
+ for i, m := range pubs.masterPublicKey {
+ mpks[i] = m.Serialize()
}
-
- for id, v := range pubs.shareCacheIndex {
- rps.ShareCacheIndexK = append(
- rps.ShareCacheIndexK, id.GetLittleEndian())
- rps.ShareCacheIndexV = append(rps.ShareCacheIndexV, uint32(v))
- }
-
- for _, m := range pubs.masterPublicKey {
- rps.MasterPublicKey = append(rps.MasterPublicKey, m.Serialize())
- }
-
- return rlp.Encode(w, rps)
+ return rlp.Encode(w, mpks)
}
// DecodeRLP implements rlp.Decoder
func (pubs *PublicKeyShares) DecodeRLP(s *rlp.Stream) error {
- var dec rlpPublicKeyShares
+ var dec [][]byte
if err := s.Decode(&dec); err != nil {
return err
}
- if len(dec.ShareCacheIndexK) != len(dec.ShareCacheIndexV) {
- return fmt.Errorf("invalid shareIndex")
- }
-
ps := NewEmptyPublicKeyShares()
- for _, share := range dec.ShareCaches {
- var publicKey PublicKey
- if err := publicKey.Deserialize(share); err != nil {
- return err
- }
- ps.shareCaches = append(ps.shareCaches, publicKey)
- }
-
- for i, k := range dec.ShareCacheIndexK {
- id, err := BytesID(k)
- if err != nil {
- return err
- }
- ps.shareCacheIndex[id] = int(dec.ShareCacheIndexV[i])
- }
-
- for _, k := range dec.MasterPublicKey {
+ for _, k := range dec {
var key bls.PublicKey
if err := key.Deserialize(k); err != nil {
return err