lightning 10.10.2 → 10.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,7 @@ const isString = n => typeof n === 'string';
|
|
|
11
11
|
const isZero = n => n === '0';
|
|
12
12
|
const {keys} = Object;
|
|
13
13
|
const microPerMilli = 1e3;
|
|
14
|
+
const minTime = n => n < 1 ? 0 : n;
|
|
14
15
|
|
|
15
16
|
/** Translate an RPC peer into a peer
|
|
16
17
|
|
|
@@ -124,7 +125,7 @@ module.exports = peer => {
|
|
|
124
125
|
is_inbound: peer.inbound,
|
|
125
126
|
is_sync_peer: isKnownSyncType ? isActiveSync(peer.sync_type) : undefined,
|
|
126
127
|
last_reconnection: !!lastReconnected ? date(lastReconnected) : undefined,
|
|
127
|
-
ping_time: ceil(Number(peer.ping_time) / microPerMilli),
|
|
128
|
+
ping_time: minTime(ceil(Number(peer.ping_time) / microPerMilli)),
|
|
128
129
|
public_key: peer.pub_key,
|
|
129
130
|
reconnection_rate: !!peer.flap_count ? peer.flap_count : undefined,
|
|
130
131
|
socket: peer.address,
|
package/package.json
CHANGED
|
@@ -122,6 +122,11 @@ const tests = [
|
|
|
122
122
|
description: 'RPC peer is mapped to peer details',
|
|
123
123
|
expected: makeExpected({}),
|
|
124
124
|
},
|
|
125
|
+
{
|
|
126
|
+
args: makePeer({ping_time: '-1'}),
|
|
127
|
+
description: 'Ping time is set to zero when negative',
|
|
128
|
+
expected: makeExpected({ping_time: 0}),
|
|
129
|
+
},
|
|
125
130
|
{
|
|
126
131
|
args: makePeer({sync_type: 'PASSIVE_SYNC'}),
|
|
127
132
|
description: 'RPC passive sync peer is mapped to peer details',
|