mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
swarm/network: Fix for local node address not being set correctly
This was causing nodes to share bad addresses during peer discovery. The Update(OverlayAddr) interface method returns an updated copy rather than mutating the existing object.
This commit is contained in:
parent
a375d95143
commit
c60d47882b
2 changed files with 3 additions and 3 deletions
|
|
@ -124,10 +124,10 @@ func NewBzz(config *BzzConfig, kad Overlay, store StateStore) *Bzz {
|
|||
|
||||
// UpdateLocalAddr updates underlayaddress of the running node
|
||||
func (b *Bzz) UpdateLocalAddr(byteaddr []byte) *BzzAddr {
|
||||
b.localAddr.Update(&BzzAddr{
|
||||
b.localAddr = b.localAddr.Update(&BzzAddr{
|
||||
UAddr: byteaddr,
|
||||
OAddr: b.localAddr.OAddr,
|
||||
})
|
||||
}).(*BzzAddr)
|
||||
return b.localAddr
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ func (self *Swarm) Start(srv *p2p.Server) error {
|
|||
|
||||
// update uaddr to correct enode
|
||||
newaddr := self.bzz.UpdateLocalAddr([]byte(srv.Self().String()))
|
||||
log.Warn("Updated bzz local addr", "oaddr", fmt.Sprintf("%x", newaddr.OAddr), "uaddr", fmt.Sprintf("%x", newaddr.UAddr))
|
||||
log.Warn("Updated bzz local addr", "oaddr", fmt.Sprintf("%x", newaddr.OAddr), "uaddr", fmt.Sprintf("%s", newaddr.UAddr))
|
||||
|
||||
// set chequebook
|
||||
if self.config.SwapEnabled {
|
||||
|
|
|
|||
Loading…
Reference in a new issue