aboutsummaryrefslogtreecommitdiffstats
path: root/core/headerchain.go
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 /core/headerchain.go
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 'core/headerchain.go')
-rw-r--r--core/headerchain.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/headerchain.go b/core/headerchain.go
index a57e509ca..e988a53a2 100644
--- a/core/headerchain.go
+++ b/core/headerchain.go
@@ -304,7 +304,7 @@ func (hc *HeaderChain) InsertHeaderChain(chain []*types.Header, writeHeader WhCa
return 0, nil
}
-func (hc *HeaderChain) WriteHeader2(header *types.HeaderWithGovState) (status WriteStatus, err error) {
+func (hc *HeaderChain) WriteDexonHeader(header *types.HeaderWithGovState) (status WriteStatus, err error) {
// Cache some values to prevent constant recalculation
var (
hash = header.Hash()
@@ -394,7 +394,7 @@ func (hc *HeaderChain) WriteHeader2(header *types.HeaderWithGovState) (status Wr
type Wh2Callback func(*types.HeaderWithGovState) error
-func (hc *HeaderChain) ValidateHeaderChain2(chain []*types.HeaderWithGovState, verifierCache *dexCore.TSigVerifierCache) (int, error) {
+func (hc *HeaderChain) ValidateDexonHeaderChain(chain []*types.HeaderWithGovState, verifierCache *dexCore.TSigVerifierCache) (int, error) {
// Do a sanity check that the provided chain is actually ordered and linked
for i := 1; i < len(chain); i++ {
if chain[i].Number.Uint64() != chain[i-1].Number.Uint64()+1 || chain[i].ParentHash != chain[i-1].Hash() {
@@ -454,7 +454,7 @@ func (hc *HeaderChain) verifyTSig(header *types.Header, verifierCache *dexCore.T
return nil
}
-// InsertHeaderChain2 attempts to insert the given header chain in to the local
+// InsertDexonHeaderChain attempts to insert the given header chain in to the local
// chain, possibly creating a reorg. If an error is returned, it will return the
// index number of the failing header as well an error describing what went wrong.
//
@@ -462,7 +462,7 @@ func (hc *HeaderChain) verifyTSig(header *types.Header, verifierCache *dexCore.T
// should be done or not. The reason behind the optional check is because some
// of the header retrieval mechanisms already need to verfy nonces, as well as
// because nonces can be verified sparsely, not needing to check each.
-func (hc *HeaderChain) InsertHeaderChain2(chain []*types.HeaderWithGovState, writeHeader Wh2Callback, start time.Time) (int, error) {
+func (hc *HeaderChain) InsertDexonHeaderChain(chain []*types.HeaderWithGovState, writeHeader Wh2Callback, start time.Time) (int, error) {
// Collect some import statistics to report on
stats := struct{ processed, ignored int }{}
// All headers passed verification, import them into the database