From 3c11bedac26ee4a8aff8305627eb518e4f1606f9 Mon Sep 17 00:00:00 2001 From: Abhishek Sinha Date: Wed, 17 Jul 2019 15:01:28 +0530 Subject: [PATCH] fixed infinite loop error in send_rpc --- supernode/index.html | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/supernode/index.html b/supernode/index.html index f5e6f92..5e20efd 100644 --- a/supernode/index.html +++ b/supernode/index.html @@ -11401,13 +11401,17 @@ if (typeof my_closest_su=="object") { if (!all_receivers_methods.includes(method)) { request.globalParams["receiversList"] = []; - for (let j = 1; j <= localbitcoinplusplus.master_configurations.MaxBackups; j++) { + let live_nodes = 0; + for (let j = 1; j <= my_closest_su.length-1; j++) { if(typeof my_closest_su[j].trader_flo_address !== "string") continue; + if(my_closest_su[j].is_live==true) { + live_nodes++; + } request.globalParams.receiversList.push(my_closest_su[j].trader_flo_address); /* If a closestNode is dead include it but also include an extra node (preferrably live) after him. Idea is that message should reach closest 'live' supernode. */ - if(my_closest_su[j].is_live==false) j--; + if (live_nodes==localbitcoinplusplus.master_configurations.MaxBackups) break; } } @@ -11437,13 +11441,17 @@ if (typeof my_closest_su=="object") { if (!all_receivers_methods.includes(method)) { request.globalParams["receiversList"] = []; - for (let j = 1; j <= localbitcoinplusplus.master_configurations.MaxBackups; j++) { + let live_nodes = 0; + for (let j = 1; j <= my_closest_su.length-1; j++) { if(typeof my_closest_su[j].trader_flo_address !== "string") continue; + if(my_closest_su[j].is_live==true) { + live_nodes++; + } request.globalParams.receiversList.push(my_closest_su[j].trader_flo_address); /* If a closestNode is dead include it but also include an extra node (preferrably live) after him. Idea is that message should reach closest 'live' supernode. */ - if(my_closest_su[j].is_live==false) j--; + if (live_nodes==localbitcoinplusplus.master_configurations.MaxBackups) break; } } }