Skip to content

Commit

Permalink
les: fixed broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zsfelfoldi committed Feb 19, 2021
1 parent f64a4e2 commit 7cde103
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions les/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import (
var (
clientSetup = &nodestate.Setup{Version: 1}
serverPeerField = clientSetup.NewField("serverPeer", reflect.TypeOf(&serverPeer{}))
valueTrackerSetup = lpc.NewValueTrackerSetup(clientSetup)
valueTrackerSetup = vfc.NewValueTrackerSetup(clientSetup)
)

func init() {
Expand Down Expand Up @@ -104,7 +104,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) {
}
log.Info("Initialised chain configuration", "config", chainConfig)

ns := nodestate.NewNodeStateMachine(lespayDb, []byte("ns:"), &mclock.System{}, clientSetup)
ns := nodestate.NewNodeStateMachine(lesDb, []byte("ns:"), &mclock.System{}, clientSetup)
peers := newServerPeerSet(ns)
leth := &LightEthereum{
lesCommons: lesCommons{
Expand Down
1 change: 1 addition & 0 deletions les/peer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func TestPeerSubscription(t *testing.T) {
sub := newTestServerPeerSub()
peers.subscribe(sub)
ns.Start()
peers.open()
defer ns.Stop()

checkIds := func(expect []string) {
Expand Down
2 changes: 1 addition & 1 deletion les/serverpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func newServerPool(ns *nodestate.NodeStateMachine, db ethdb.KeyValueStore, vt *v

s.ns.SubscribeField(valueTrackerSetup.ValueTrackerField, func(node *enode.Node, state nodestate.Flags, oldValue, newValue interface{}) {
if newValue != nil {
nvt := newValue.(*lpc.NodeValueTracker)
nvt := newValue.(*vfc.NodeValueTracker)
s.ns.SetStateSub(node, sfConnected, sfDialing.Or(sfWaitDialTimeout), 0)
s.ns.SetFieldSub(node, sfiConnectedStats, nvt.RtStats())
p := s.ns.GetField(node, serverPeerField).(*serverPeer)
Expand Down
1 change: 1 addition & 0 deletions les/test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ func newClientServerEnv(t *testing.T, blocks int, protocol int, callback indexer
client := newTestClientHandler(b, odr, cIndexers, cdb, speers, ulcServers, ulcFraction)

ns.Start()
speers.open()
scIndexer.Start(server.blockchain)
sbIndexer.Start(server.blockchain)
ccIndexer.Start(client.backend.blockchain)
Expand Down

0 comments on commit 7cde103

Please sign in to comment.