fix: use toB58String everywhere to be consistent (#537)

* chore: update deps

* fix: consistently use b58 peerid string

The migration to base32 will happen at a later date
This commit is contained in:
Jacob Heun
2020-01-22 11:47:30 +01:00
parent bb2e56e6c7
commit c1038bec92
14 changed files with 58 additions and 51 deletions

View File

@ -74,7 +74,7 @@ class Registrar {
assert(PeerInfo.isPeerInfo(peerInfo), 'peerInfo must be an instance of peer-info')
assert(Connection.isConnection(conn), 'conn must be an instance of interface-connection')
const id = peerInfo.id.toString()
const id = peerInfo.id.toB58String()
const storedConn = this.connections.get(id)
if (storedConn) {
@ -95,7 +95,7 @@ class Registrar {
onDisconnect (peerInfo, connection, error) {
assert(PeerInfo.isPeerInfo(peerInfo), 'peerInfo must be an instance of peer-info')
const id = peerInfo.id.toString()
const id = peerInfo.id.toB58String()
let storedConn = this.connections.get(id)
if (storedConn && storedConn.length > 1) {
@ -106,7 +106,7 @@ class Registrar {
topology.disconnect(peerInfo, error)
}
this.connections.delete(peerInfo.id.toString())
this.connections.delete(peerInfo.id.toB58String())
}
}
@ -118,7 +118,7 @@ class Registrar {
getConnection (peerInfo) {
assert(PeerInfo.isPeerInfo(peerInfo), 'peerInfo must be an instance of peer-info')
const connections = this.connections.get(peerInfo.id.toString())
const connections = this.connections.get(peerInfo.id.toB58String())
// Return the first, open connection
if (connections) {
return connections.find(connection => connection.stat.status === 'open')