aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorSonic <sonic@dexon.org>2018-11-21 13:37:16 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:53 +0800
commit4e8a8dd1105a3392e3b8a489c8b9f80a3492b670 (patch)
tree247c6a822ea852e1625619e76aa34e43edaee29b /dex
parente11a62b9e6d1acb1c9bb0abb997e5721f35e489f (diff)
downloaddexon-4e8a8dd1105a3392e3b8a489c8b9f80a3492b670.tar
dexon-4e8a8dd1105a3392e3b8a489c8b9f80a3492b670.tar.gz
dexon-4e8a8dd1105a3392e3b8a489c8b9f80a3492b670.tar.bz2
dexon-4e8a8dd1105a3392e3b8a489c8b9f80a3492b670.tar.lz
dexon-4e8a8dd1105a3392e3b8a489c8b9f80a3492b670.tar.xz
dexon-4e8a8dd1105a3392e3b8a489c8b9f80a3492b670.tar.zst
dexon-4e8a8dd1105a3392e3b8a489c8b9f80a3492b670.zip
core, dex, dex/downloader: restore insertChain to upstream version
Also rename InsertChain2, insertChain2, InsertHeaderChain2, ValidateHeaderChain2
Diffstat (limited to 'dex')
-rw-r--r--dex/downloader/downloader.go12
-rw-r--r--dex/handler.go2
2 files changed, 7 insertions, 7 deletions
diff --git a/dex/downloader/downloader.go b/dex/downloader/downloader.go
index 69d95d801..828c7c6bc 100644
--- a/dex/downloader/downloader.go
+++ b/dex/downloader/downloader.go
@@ -180,8 +180,8 @@ type LightChain interface {
// GetTd returns the total difficulty of a local block.
GetTd(common.Hash, uint64) *big.Int
- // InsertHeaderChain2 inserts a batch of headers into the local chain.
- InsertHeaderChain2([]*types.HeaderWithGovState, *dexCore.TSigVerifierCache) (int, error)
+ // InsertDexonHeaderChain inserts a batch of headers into the local chain.
+ InsertDexonHeaderChain([]*types.HeaderWithGovState, *dexCore.TSigVerifierCache) (int, error)
// Rollback removes a few recently added elements from the local chain.
Rollback([]common.Hash)
@@ -206,8 +206,8 @@ type BlockChain interface {
// FastSyncCommitHead directly commits the head block to a certain entity.
FastSyncCommitHead(common.Hash) error
- // InsertChain2 inserts a batch of blocks into the local chain.
- InsertChain2(types.Blocks) (int, error)
+ // InsertDexonChain inserts a batch of blocks into the local chain.
+ InsertDexonChain(types.Blocks) (int, error)
// InsertReceiptChain inserts a batch of receipts into the local chain.
InsertReceiptChain(types.Blocks, []types.Receipts) (int, error)
@@ -1421,7 +1421,7 @@ func (d *Downloader) processHeaders(origin uint64, pivot uint64, td *big.Int) er
}
}
- if n, err := d.lightchain.InsertHeaderChain2(chunk, d.verifierCache); err != nil {
+ if n, err := d.lightchain.InsertDexonHeaderChain(chunk, d.verifierCache); err != nil {
// If some headers were inserted, add them too to the rollback list
if n > 0 {
for _, h := range chunk[:n] {
@@ -1513,7 +1513,7 @@ func (d *Downloader) importBlockResults(results []*fetchResult) error {
for i, result := range results {
blocks[i] = types.NewBlockWithHeader(result.Header).WithBody(result.Transactions, result.Uncles)
}
- if index, err := d.blockchain.InsertChain2(blocks); err != nil {
+ if index, err := d.blockchain.InsertDexonChain(blocks); err != nil {
log.Debug("Downloaded item processing failed", "number", results[index].Header.Number, "hash", results[index].Header.Hash(), "err", err)
return errInvalidChain
}
diff --git a/dex/handler.go b/dex/handler.go
index 0c7a3e919..a86a68329 100644
--- a/dex/handler.go
+++ b/dex/handler.go
@@ -221,7 +221,7 @@ func NewProtocolManager(
return 0, nil
}
atomic.StoreUint32(&manager.acceptTxs, 1) // Mark initial sync done on any fetcher import
- return manager.blockchain.InsertChain2(blocks)
+ return manager.blockchain.InsertDexonChain(blocks)
}
manager.fetcher = fetcher.New(blockchain.GetBlockByHash, validator, manager.BroadcastBlock, heighter, inserter, manager.removePeer)