fix: use libp2p.multiaddrs instead of listen

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>
This commit is contained in:
Vasco Santos
2020-04-29 16:08:52 +02:00
committed by Jacob Heun
parent 51474c334a
commit 7fbd1556e8
5 changed files with 9 additions and 10 deletions

View File

@ -32,7 +32,7 @@ class Circuit {
this._connectionManager = libp2p.connectionManager
this._upgrader = upgrader
this._options = libp2p._config.relay
this.addressManager = libp2p.addressManager
this._libp2p = libp2p
this.peerId = libp2p.peerId
this._registrar.handle(multicodec, this._onProtocol.bind(this))
}
@ -122,7 +122,7 @@ class Circuit {
type: CircuitPB.Type.HOP,
srcPeer: {
id: this.peerId.toBytes(),
addrs: this.addressManager.getListenAddrs().map(addr => addr.buffer)
addrs: this._libp2p.multiaddrs.map(addr => addr.buffer)
},
dstPeer: {
id: destinationPeer.toBytes(),

View File

@ -189,8 +189,7 @@ class Libp2p extends EventEmitter {
*/
async start () {
log('libp2p is starting')
// TODO: consider validate listen addresses on start?
// depend on transports?
try {
await this._onStarting()
await this._onDidStart()