aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSonic <sonic@dexon.org>2018-11-30 12:35:33 +0800
committerWei-Ning Huang <w@dexon.org>2018-12-19 20:54:27 +0800
commit4216690a7970960c7182999a05570eddd2944c66 (patch)
treea8164e502023b18b8499077ae7ae5fda5abc602d
parent6d18923fd6228372a4b3ed0ced002f10be66041a (diff)
downloaddexon-4216690a7970960c7182999a05570eddd2944c66.tar
dexon-4216690a7970960c7182999a05570eddd2944c66.tar.gz
dexon-4216690a7970960c7182999a05570eddd2944c66.tar.bz2
dexon-4216690a7970960c7182999a05570eddd2944c66.tar.lz
dexon-4216690a7970960c7182999a05570eddd2944c66.tar.xz
dexon-4216690a7970960c7182999a05570eddd2944c66.tar.zst
dexon-4216690a7970960c7182999a05570eddd2944c66.zip
dex: verify header that imported from fetcher (#68)
-rw-r--r--core/blockchain.go4
-rw-r--r--dex/handler.go2
2 files changed, 5 insertions, 1 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index bc9f2180f..679ba1ca3 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -1728,6 +1728,10 @@ func (bc *BlockChain) insertDexonChain(chain types.Blocks) (int, []interface{},
return 0, events, coalescedLogs, nil
}
+func (bc *BlockChain) VerifyDexonHeader(header *types.Header) error {
+ return bc.hc.verifyTSig(header, bc.verifierCache)
+}
+
func (bc *BlockChain) ProcessPendingBlock(block *types.Block, witness *coreTypes.Witness) (*common.Hash, error) {
n, events, logs, err := bc.processPendingBlock(block, witness)
bc.PostChainEvents(events, logs)
diff --git a/dex/handler.go b/dex/handler.go
index 6260d9be8..99bceb80a 100644
--- a/dex/handler.go
+++ b/dex/handler.go
@@ -213,7 +213,7 @@ func NewProtocolManager(
manager.downloader = downloader.New(mode, chaindb, manager.eventMux, blockchain, nil, manager.removePeer)
validator := func(header *types.Header) error {
- return engine.VerifyHeader(blockchain, header, true)
+ return blockchain.VerifyDexonHeader(header)
}
heighter := func() uint64 {
return blockchain.CurrentBlock().NumberU64()