diff options
author | Felix Lange <fjl@users.noreply.github.com> | 2018-08-17 18:21:53 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-08-17 18:21:53 +0800 |
commit | 2695fa2213fe5010a80970bca1078834662d5972 (patch) | |
tree | c6bda44cc6c86c378f6717b3d896ac339360e9d3 /les/helper_test.go | |
parent | f44046a1c6889049dbf0f9448075a43f5b280b09 (diff) | |
download | dexon-2695fa2213fe5010a80970bca1078834662d5972.tar.gz dexon-2695fa2213fe5010a80970bca1078834662d5972.tar.zst dexon-2695fa2213fe5010a80970bca1078834662d5972.zip |
les: fix crasher in NodeInfo when running as server (#17419)
* les: fix crasher in NodeInfo when running as server
The ProtocolManager computes CHT and Bloom trie roots by asking the
indexers for their current head. It tried to get the indexers from
LesOdr, but no LesOdr instance is created in server mode.
Attempt to fix this by moving the indexers, protocol creation and
NodeInfo to a new lesCommons struct which is embedded into both server
and client.
All this setup code should really be cleaned up, but this is just a
hotfix so we have to do that some other time.
* les: fix commons protocol maker
Diffstat (limited to 'les/helper_test.go')
-rw-r--r-- | les/helper_test.go | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/les/helper_test.go b/les/helper_test.go index 50c97e06e..8817c20c7 100644 --- a/les/helper_test.go +++ b/les/helper_test.go @@ -172,18 +172,12 @@ func newTestProtocolManager(lightSync bool, blocks int, generator func(int, *cor chain = blockchain } - var protocolVersions []uint - if lightSync { - protocolVersions = ClientProtocolVersions - } else { - protocolVersions = ServerProtocolVersions - } - pm, err := NewProtocolManager(gspec.Config, lightSync, protocolVersions, NetworkId, evmux, engine, peers, chain, nil, db, odr, nil, nil, make(chan struct{}), new(sync.WaitGroup)) + pm, err := NewProtocolManager(gspec.Config, lightSync, NetworkId, evmux, engine, peers, chain, nil, db, odr, nil, nil, make(chan struct{}), new(sync.WaitGroup)) if err != nil { return nil, err } if !lightSync { - srv := &LesServer{protocolManager: pm} + srv := &LesServer{lesCommons: lesCommons{protocolManager: pm}} pm.server = srv srv.defParams = &flowcontrol.ServerParams{ |