bugfix: properly handle no LES service (#272)

This commit is contained in:
Adam Babik 2017-08-26 09:42:34 +02:00 committed by Ivan Tomilov
parent a4d2fdfa4a
commit 9f57cf422f
2 changed files with 19 additions and 0 deletions

View File

@ -202,6 +202,7 @@ func (m *StatusBackend) registerHandlers() error {
var lightEthereum *les.LightEthereum
if err := runningNode.Service(&lightEthereum); err != nil {
log.Error("Cannot get light ethereum service", "error", err)
return err
}
lightEthereum.StatusBackend.SetAccountsFilterHandler(m.accountManager.AccountsListRequestHandler())

View File

@ -14,9 +14,27 @@ import (
"github.com/status-im/status-go/geth/node"
"github.com/status-im/status-go/geth/params"
. "github.com/status-im/status-go/geth/testing"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
func TestStartNodeWithUpstreamEnabled(t *testing.T) {
backend := api.NewStatusBackend()
require.NotNil(t, backend)
nodeConfig, err := MakeTestNodeConfig(params.RopstenNetworkID)
require.NoError(t, err)
nodeConfig.UpstreamConfig.Enabled = true
nodeStarted, err := backend.StartNode(nodeConfig)
require.NoError(t, err)
defer backend.StopNode()
<-nodeStarted
require.True(t, backend.IsNodeRunning())
}
func TestBackendTestSuite(t *testing.T) {
suite.Run(t, new(BackendTestSuite))
}