les: fix GetProofsV2 bug (#21896)

pull/21903/head
Felföldi Zsolt 4 years ago committed by GitHub
parent 6b58409614
commit bddd103a9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      les/server_handler.go

@ -610,6 +610,7 @@ func (h *serverHandler) handleMsg(p *clientPeer, wg *sync.WaitGroup) error {
var ( var (
lastBHash common.Hash lastBHash common.Hash
root common.Hash root common.Hash
header *types.Header
) )
reqCnt := len(req.Reqs) reqCnt := len(req.Reqs)
if accept(req.ReqID, uint64(reqCnt), MaxProofsFetch) { if accept(req.ReqID, uint64(reqCnt), MaxProofsFetch) {
@ -624,10 +625,6 @@ func (h *serverHandler) handleMsg(p *clientPeer, wg *sync.WaitGroup) error {
return return
} }
// Look up the root hash belonging to the request // Look up the root hash belonging to the request
var (
header *types.Header
trie state.Trie
)
if request.BHash != lastBHash { if request.BHash != lastBHash {
root, lastBHash = common.Hash{}, request.BHash root, lastBHash = common.Hash{}, request.BHash
@ -654,6 +651,7 @@ func (h *serverHandler) handleMsg(p *clientPeer, wg *sync.WaitGroup) error {
// Open the account or storage trie for the request // Open the account or storage trie for the request
statedb := h.blockchain.StateCache() statedb := h.blockchain.StateCache()
var trie state.Trie
switch len(request.AccKey) { switch len(request.AccKey) {
case 0: case 0:
// No account key specified, open an account trie // No account key specified, open an account trie

Loading…
Cancel
Save