aboutsummaryrefslogtreecommitdiffstats
path: root/core/consensus.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-08-16 16:20:17 +0800
committerGitHub <noreply@github.com>2018-08-16 16:20:17 +0800
commitd4e4999055549012dc5dd374e04b6059c2854c86 (patch)
tree386b675295693a47817069f073a68e4423ee8066 /core/consensus.go
parent9266273b790d4fa8c68e2d0fce290fe58923187b (diff)
downloaddexon-consensus-d4e4999055549012dc5dd374e04b6059c2854c86.tar
dexon-consensus-d4e4999055549012dc5dd374e04b6059c2854c86.tar.gz
dexon-consensus-d4e4999055549012dc5dd374e04b6059c2854c86.tar.bz2
dexon-consensus-d4e4999055549012dc5dd374e04b6059c2854c86.tar.lz
dexon-consensus-d4e4999055549012dc5dd374e04b6059c2854c86.tar.xz
dexon-consensus-d4e4999055549012dc5dd374e04b6059c2854c86.tar.zst
dexon-consensus-d4e4999055549012dc5dd374e04b6059c2854c86.zip
core: Remove notary ack. (#64)
Diffstat (limited to 'core/consensus.go')
-rw-r--r--core/consensus.go47
1 files changed, 25 insertions, 22 deletions
diff --git a/core/consensus.go b/core/consensus.go
index d5ce923..3e8f87d 100644
--- a/core/consensus.go
+++ b/core/consensus.go
@@ -48,8 +48,8 @@ var (
"hash of block is incorrect")
ErrIncorrectSignature = fmt.Errorf(
"signature of block is incorrect")
- ErrIncorrectCompactionChainAck = fmt.Errorf(
- "compaction chain ack of block is incorrect")
+ ErrIncorrectNotaryAck = fmt.Errorf(
+ "compaction chain notary of block is incorrect")
ErrGenesisBlockNotEmpty = fmt.Errorf(
"genesis block should be empty")
)
@@ -120,26 +120,29 @@ func (con *Consensus) sanityCheck(blockConv types.BlockConverter) (err error) {
return ErrIncorrectSignature
}
- // Check the compaction chain info.
- if ackingBlockHash :=
- b.CompactionChainAck.AckingBlockHash; (ackingBlockHash != common.Hash{}) {
- ackingBlock, err := con.db.Get(ackingBlockHash)
- if err != nil {
- return err
- }
- hash, err := hashConsensusInfo(&ackingBlock)
- if err != nil {
- return err
- }
- pubKey, err := con.sigToPub(hash,
- b.CompactionChainAck.ConsensusInfoSignature)
- if err != nil {
- return err
- }
- if !b.ProposerID.Equal(crypto.Keccak256Hash(pubKey.Bytes())) {
- return ErrIncorrectCompactionChainAck
+ // TODO(jimmy-dexon): remove these comments before open source.
+ /*
+ // Check the notary ack.
+ if notaryBlockHash :=
+ b.NotaryAck.NotaryBlockHash; (notaryBlockHash != common.Hash{}) {
+ notaryBlock, err := con.db.Get(notaryBlockHash)
+ if err != nil {
+ return err
+ }
+ hash, err := hashNotary(&notaryBlock)
+ if err != nil {
+ return err
+ }
+ pubKey, err := con.sigToPub(hash,
+ b.NotaryAck.NotarySignature)
+ if err != nil {
+ return err
+ }
+ if !b.ProposerID.Equal(crypto.Keccak256Hash(pubKey.Bytes())) {
+ return ErrIncorrectNotaryAck
+ }
}
- }
+ */
return nil
}
@@ -199,7 +202,7 @@ func (con *Consensus) ProcessBlock(blockConv types.BlockConverter) (err error) {
if err = con.db.Update(*b); err != nil {
return
}
- con.app.DeliverBlock(b.Hash, b.ConsensusInfo.Timestamp)
+ con.app.DeliverBlock(b.Hash, b.Notary.Timestamp)
}
}
return