Skip to content

Commit 13157b0

Browse files
author
Karl Ranna
committed
fix(p2p): change connext_address to connext_identifier
BREAKING CHANGE: `connext_address` field in `NodeState` has been renamed to `connext_identifier`. Related: opendexnetwork/opendex.network#28 Closes: #1611
1 parent 55876ae commit 13157b0

File tree

10 files changed

+25
-23
lines changed

10 files changed

+25
-23
lines changed

Diff for: docs/api.md

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/p2p/Peer.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type PeerInfo = {
3232
secondsConnected: number,
3333
lndPubKeys?: { [currency: string]: string | undefined },
3434
raidenAddress?: string,
35-
connextAddress?: string,
35+
connextIdentifier?: string,
3636
};
3737

3838
enum PeerStatus {
@@ -162,8 +162,8 @@ class Peer extends EventEmitter {
162162
return this.nodeState ? this.nodeState.raidenAddress : undefined;
163163
}
164164

165-
public get connextAddress(): string | undefined {
166-
return this.nodeState ? this.nodeState.connextAddress : undefined;
165+
public get connextIdentifier(): string | undefined {
166+
return this.nodeState ? this.nodeState.connextIdentifier : undefined;
167167
}
168168

169169
/** Returns a list of trading pairs advertised by this peer. */
@@ -189,7 +189,7 @@ class Peer extends EventEmitter {
189189
secondsConnected: Math.round((Date.now() - this.connectTime) / 1000),
190190
lndPubKeys: this.nodeState ? this.nodeState.lndPubKeys : undefined,
191191
raidenAddress: this.nodeState ? this.nodeState.raidenAddress : undefined,
192-
connextAddress: this.nodeState ? this.nodeState.connextAddress : undefined,
192+
connextIdentifier: this.nodeState ? this.nodeState.connextIdentifier : undefined,
193193
};
194194
}
195195

@@ -242,7 +242,7 @@ class Peer extends EventEmitter {
242242
switch (clientType) {
243243
case SwapClientType.Lnd: return this.getLndPubKey(currency);
244244
case SwapClientType.Raiden: return this.raidenAddress;
245-
case SwapClientType.Connext: return this.connextAddress;
245+
case SwapClientType.Connext: return this.connextIdentifier;
246246
default: return;
247247
}
248248
}

Diff for: lib/p2p/Pool.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class Pool extends EventEmitter {
125125
addresses: [],
126126
pairs: [],
127127
raidenAddress: '',
128-
connextAddress: '',
128+
connextIdentifier: '',
129129
lndPubKeys: {},
130130
lndUris: {},
131131
tokenIdentifiers: {},
@@ -246,7 +246,7 @@ class Pool extends EventEmitter {
246246
* packet to currently connected peers to notify them of the change.
247247
*/
248248
public updateConnextState = (tokenAddresses: Map<string, string>, pubKey?: string) => {
249-
this.nodeState.connextAddress = pubKey || '';
249+
this.nodeState.connextIdentifier = pubKey || '';
250250
tokenAddresses.forEach((tokenAddress, currency) => {
251251
this.nodeState.tokenIdentifiers[currency] = tokenAddress;
252252
});

Diff for: lib/p2p/packets/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const convertNodeState = (nodeState: pb.NodeState.AsObject) => {
1818
pairs: nodeState.pairsList,
1919
addresses: nodeState.addressesList,
2020
raidenAddress: nodeState.raidenAddress,
21-
connextAddress: nodeState.connextAddress,
21+
connextIdentifier: nodeState.connextIdentifier,
2222
lndPubKeys: convertKvpArrayToKvps(nodeState.lndPubKeysMap),
2323
lndUris: convertLndUris(nodeState.lndUrisMap),
2424
tokenIdentifiers: convertKvpArrayToKvps(nodeState.tokenIdentifiersMap),
@@ -56,7 +56,7 @@ export const serializeNodeState = (nodeState: NodeState): pb.NodeState => {
5656
return pbAddr;
5757
}));
5858
pbNodeState.setRaidenAddress(nodeState.raidenAddress);
59-
pbNodeState.setConnextAddress(nodeState.connextAddress);
59+
pbNodeState.setConnextIdentifier(nodeState.connextIdentifier);
6060
if (nodeState.lndPubKeys) {
6161
setObjectToMap(nodeState.lndPubKeys, pbNodeState.getLndPubKeysMap());
6262
}

Diff for: lib/p2p/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export type NodeState = {
1717
addresses: Address[];
1818
pairs: string[];
1919
raidenAddress: string;
20-
connextAddress: string;
20+
connextIdentifier: string;
2121
/** An object mapping currency symbols to lnd pub keys. */
2222
lndPubKeys: { [currency: string]: string | undefined };
2323
/** An object mapping currency symbols to lnd listening uris */

Diff for: lib/proto/xudp2p_pb.d.ts

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/proto/xudp2p_pb.js

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: proto/xudp2p.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ message NodeState {
3131
map<string, string> lnd_pub_keys = 6;
3232
map<string, string> token_identifiers = 7;
3333
map<string, LndUris> lnd_uris = 8;
34-
string connext_address = 9;
34+
string connext_identifier = 9;
3535
}
3636

3737
message PingPacket {

Diff for: test/jest/Pool.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ describe('P2P Pool', () => {
147147
addresses: [{ host: '1.1.1.1', port: poolPort }, { host: '2.2.2.2', port: poolPort }],
148148
pairs: [uuid()],
149149
raidenAddress: uuid(),
150-
connextAddress: uuid(),
150+
connextIdentifier: uuid(),
151151
lndPubKeys: { BTC: uuid(), LTC: uuid() },
152152
lndUris: { BTC: [''], LTC: [''] },
153153
tokenIdentifiers: { BTC: 'bitcoin-testnet', LTC: 'litecoin-testnet' },
@@ -169,7 +169,7 @@ describe('P2P Pool', () => {
169169
addresses: [{ host: '1.1.1.1', port: poolPort }, { host: '2.2.2.2', port: poolPort }],
170170
pairs: [uuid()],
171171
raidenAddress: uuid(),
172-
connextAddress: uuid(),
172+
connextIdentifier: uuid(),
173173
lndPubKeys: { BTC: uuid(), LTC: uuid() },
174174
lndUris: { BTC: [''], LTC: [''] },
175175
tokenIdentifiers: { BTC: 'bitcoin-testnet', LTC: 'litecoin-testnet' },

Diff for: test/unit/Parser.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ describe('Parser', () => {
193193
addresses: [{ host: '1.1.1.1', port: 8885 }, { host: '2.2.2.2', port: 8885 }],
194194
pairs: [uuid()],
195195
raidenAddress: uuid(),
196-
connextAddress: uuid(),
196+
connextIdentifier: uuid(),
197197
lndPubKeys: { BTC: uuid(), LTC: uuid() },
198198
lndUris: { BTC: [''], LTC: [''] },
199199
tokenIdentifiers: { BTC: 'bitcoin-testnet', LTC: 'litecoin-testnet' },

0 commit comments

Comments
 (0)