rpc, xeth: fix #881, gracefully handle offline whisper

This commit is contained in:
Péter Szilágyi
2015-05-11 11:53:53 +03:00
parent 00280e62e3
commit 0ad5898c0f
4 changed files with 53 additions and 2 deletions

View File

@ -79,7 +79,6 @@ func New(eth *eth.Ethereum, frontend Frontend) *XEth {
xeth := &XEth{
backend: eth,
frontend: frontend,
whisper: NewWhisper(eth.Whisper()),
quit: make(chan struct{}),
filterManager: filter.NewFilterManager(eth.EventMux()),
logQueue: make(map[int]*logQueue),
@ -88,6 +87,9 @@ func New(eth *eth.Ethereum, frontend Frontend) *XEth {
messages: make(map[int]*whisperFilter),
agent: miner.NewRemoteAgent(),
}
if eth.Whisper() != nil {
xeth.whisper = NewWhisper(eth.Whisper())
}
eth.Miner().Register(xeth.agent)
if frontend == nil {
xeth.frontend = dummyFrontend{}