create addrbook even if pex=false. fixes #1525

This commit is contained in:
Ethan Buchman
2018-04-30 08:31:03 -04:00
parent b6c062c451
commit 47557f868a

View File

@ -274,11 +274,11 @@ func NewNode(config *cfg.Config,
// if auth_enc=false. // if auth_enc=false.
// //
// If PEX is on, it should handle dialing the seeds. Otherwise the switch does it. // If PEX is on, it should handle dialing the seeds. Otherwise the switch does it.
// Note we currently use the addrBook regardless at least for AddOurAddress
var addrBook pex.AddrBook var addrBook pex.AddrBook
if config.P2P.PexReactor {
addrBook = pex.NewAddrBook(config.P2P.AddrBookFile(), config.P2P.AddrBookStrict) addrBook = pex.NewAddrBook(config.P2P.AddrBookFile(), config.P2P.AddrBookStrict)
addrBook.SetLogger(p2pLogger.With("book", config.P2P.AddrBookFile())) addrBook.SetLogger(p2pLogger.With("book", config.P2P.AddrBookFile()))
if config.P2P.PexReactor {
// TODO persistent peers ? so we can have their DNS addrs saved // TODO persistent peers ? so we can have their DNS addrs saved
pexReactor := pex.NewPEXReactor(addrBook, pexReactor := pex.NewPEXReactor(addrBook,
&pex.PEXReactorConfig{ &pex.PEXReactorConfig{