aboutsummaryrefslogtreecommitdiffstats
path: root/les/odr_requests.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-09-20 19:11:14 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-09-20 19:14:48 +0800
commitaf89093116d2a4657c79d55f61b4293753b52588 (patch)
tree73a0b04eb9e3965be98219649f12595d9a26379c /les/odr_requests.go
parentf89dce0126f92eb5f3245f6b8e8b1e3ac13641b3 (diff)
downloaddexon-af89093116d2a4657c79d55f61b4293753b52588.tar
dexon-af89093116d2a4657c79d55f61b4293753b52588.tar.gz
dexon-af89093116d2a4657c79d55f61b4293753b52588.tar.bz2
dexon-af89093116d2a4657c79d55f61b4293753b52588.tar.lz
dexon-af89093116d2a4657c79d55f61b4293753b52588.tar.xz
dexon-af89093116d2a4657c79d55f61b4293753b52588.tar.zst
dexon-af89093116d2a4657c79d55f61b4293753b52588.zip
les, light, params: update light client CHTs
Diffstat (limited to 'les/odr_requests.go')
-rw-r--r--les/odr_requests.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/les/odr_requests.go b/les/odr_requests.go
index 9e9b2673f..77b1b6d0c 100644
--- a/les/odr_requests.go
+++ b/les/odr_requests.go
@@ -478,7 +478,7 @@ func (r *ChtRequest) Validate(db ethdb.Database, msg *Msg) error {
}
type BloomReq struct {
- BloomTrieNum, BitIdx, SectionIdx, FromLevel uint64
+ BloomTrieNum, BitIdx, SectionIndex, FromLevel uint64
}
// ODR request type for requesting headers by Canonical Hash Trie, see LesOdrRequest interface
@@ -487,7 +487,7 @@ type BloomRequest light.BloomRequest
// GetCost returns the cost of the given ODR request according to the serving
// peer's cost table (implementation of LesOdrRequest)
func (r *BloomRequest) GetCost(peer *peer) uint64 {
- return peer.GetRequestCost(GetHelperTrieProofsMsg, len(r.SectionIdxList))
+ return peer.GetRequestCost(GetHelperTrieProofsMsg, len(r.SectionIndexList))
}
// CanSend tells if a certain peer is suitable for serving the given request
@@ -503,13 +503,13 @@ func (r *BloomRequest) CanSend(peer *peer) bool {
// Request sends an ODR request to the LES network (implementation of LesOdrRequest)
func (r *BloomRequest) Request(reqID uint64, peer *peer) error {
- peer.Log().Debug("Requesting BloomBits", "bloomTrie", r.BloomTrieNum, "bitIdx", r.BitIdx, "sections", r.SectionIdxList)
- reqs := make([]HelperTrieReq, len(r.SectionIdxList))
+ peer.Log().Debug("Requesting BloomBits", "bloomTrie", r.BloomTrieNum, "bitIdx", r.BitIdx, "sections", r.SectionIndexList)
+ reqs := make([]HelperTrieReq, len(r.SectionIndexList))
var encNumber [10]byte
binary.BigEndian.PutUint16(encNumber[:2], uint16(r.BitIdx))
- for i, sectionIdx := range r.SectionIdxList {
+ for i, sectionIdx := range r.SectionIndexList {
binary.BigEndian.PutUint64(encNumber[2:], sectionIdx)
reqs[i] = HelperTrieReq{
Type: htBloomBits,
@@ -524,7 +524,7 @@ func (r *BloomRequest) Request(reqID uint64, peer *peer) error {
// returns true and stores results in memory if the message was a valid reply
// to the request (implementation of LesOdrRequest)
func (r *BloomRequest) Validate(db ethdb.Database, msg *Msg) error {
- log.Debug("Validating BloomBits", "bloomTrie", r.BloomTrieNum, "bitIdx", r.BitIdx, "sections", r.SectionIdxList)
+ log.Debug("Validating BloomBits", "bloomTrie", r.BloomTrieNum, "bitIdx", r.BitIdx, "sections", r.SectionIndexList)
// Ensure we have a correct message with a single proof element
if msg.MsgType != MsgHelperTrieProofs {
@@ -535,13 +535,13 @@ func (r *BloomRequest) Validate(db ethdb.Database, msg *Msg) error {
nodeSet := proofs.NodeSet()
reads := &readTraceDB{db: nodeSet}
- r.BloomBits = make([][]byte, len(r.SectionIdxList))
+ r.BloomBits = make([][]byte, len(r.SectionIndexList))
// Verify the proofs
var encNumber [10]byte
binary.BigEndian.PutUint16(encNumber[:2], uint16(r.BitIdx))
- for i, idx := range r.SectionIdxList {
+ for i, idx := range r.SectionIndexList {
binary.BigEndian.PutUint64(encNumber[2:], idx)
value, _, err := trie.VerifyProof(r.BloomTrieRoot, encNumber[:], reads)
if err != nil {