Skip to content
Snippets Groups Projects
Commit e28c3335 authored by Baptiste Lemoine's avatar Baptiste Lemoine
Browse files

#1120 - :zap: - log message "Peer with zero endpoints that is not already...

#1120 - :zap:

 - log message "Peer with zero endpoints that is not already known" instead of throwing an error

Signed-off-by: default avatarBaptiste Lemoine <contact@cipherbliss.com>
parent 7fa66ba4
No related branches found
No related tags found
No related merge requests found
...@@ -160,9 +160,10 @@ export class PeeringService { ...@@ -160,9 +160,10 @@ export class PeeringService {
let found = await this.dal.getPeerOrNull(thePeer.pubkey); let found = await this.dal.getPeerOrNull(thePeer.pubkey);
let peerEntityOld = PeerDTO.fromJSONObject(found || thePeer) let peerEntityOld = PeerDTO.fromJSONObject(found || thePeer)
if (!found && thePeerDTO.endpoints.length === 0) { if (!found && thePeerDTO.endpoints.length === 0) {
throw 'Peer with zero endpoints that is not already known' let logMessage = 'Peer with zero endpoints that is not already known';
} this.server.logger.info(logMessage);
else if(found){
} else if (found) {
// Already existing peer // Already existing peer
const sp2 = found.block.split('-'); const sp2 = found.block.split('-');
const previousBlockNumber = parseInt(sp2[0]); const previousBlockNumber = parseInt(sp2[0]);
...@@ -268,7 +269,8 @@ export class PeeringService { ...@@ -268,7 +269,8 @@ export class PeeringService {
/********************* /*********************
* Renew peer document * Renew peer document
*********************/ *********************/
// Choosing next based-block for our peer record: we basically want the most distant possible from current // Choosing next based-block for our peer record: we basically want the most distant possible from
// current
let minBlock = current ? current.number - 30 : 0; let minBlock = current ? current.number - 30 : 0;
if (p1) { if (p1) {
// But if already have a peer record within this distance, we need to take the next block of it // But if already have a peer record within this distance, we need to take the next block of it
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment