@pioneer-platform/blockbook 8.38.5 → 8.38.8

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.
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > @pioneer-platform/blockbook@8.38.5 build /Users/highlander/WebstormProjects/keepkey-stack/projects/pioneer/modules/intergrations/blockbook
3
+ > @pioneer-platform/blockbook@8.38.8 build /Users/highlander/WebstormProjects/keepkey-stack/projects/pioneer/modules/intergrations/blockbook
4
4
  > tsc -p .
5
5
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @pioneer-platform/blockbook
2
2
 
3
+ ## 8.38.8
4
+
5
+ ### Patch Changes
6
+
7
+ - chore: fix: watchtower polling missing dual Redis write causing block heights to fall back to default
8
+
9
+ ## 8.38.7
10
+
11
+ ### Patch Changes
12
+
13
+ - fix: watchtower polling missing dual Redis write causing block heights to fall back to default
14
+
15
+ ## 8.38.6
16
+
17
+ ### Patch Changes
18
+
19
+ - fix: watchtower polling missing dual Redis write causing block heights to fall back to default
20
+
3
21
  ## 8.38.5
4
22
 
5
23
  ### Patch Changes
package/lib/index.js CHANGED
@@ -810,7 +810,7 @@ var get_txs_by_xpub = function (coin, xpub) {
810
810
  };
811
811
  var broadcast_transaction = function (coin, hex) {
812
812
  return __awaiter(this, void 0, void 0, function () {
813
- var tag, symbol, nodes_2, activeNodes, MAX_RETRIES, RETRY_DELAY_MS_1, allErrors, retry, _loop_1, i, state_1, errorSummary, allErrorsAreMempoolConflict, calculatedTxid, e_8;
813
+ var tag, symbol, nodes_2, activeNodes, recovered, MAX_RETRIES, RETRY_DELAY_MS_1, allErrors, retry, _loop_1, i, state_1, errorSummary, allErrorsAreMempoolConflict, calculatedTxid, e_8;
814
814
  var _a, _b;
815
815
  return __generator(this, function (_c) {
816
816
  switch (_c.label) {
@@ -826,7 +826,13 @@ var broadcast_transaction = function (coin, hex) {
826
826
  }
827
827
  activeNodes = nodes_2.filter(function (n) { return n.isActive; }).sort(function (a, b) { return a.priority - b.priority; });
828
828
  if (activeNodes.length === 0) {
829
- throw new Error("No active nodes available for ".concat(symbol));
829
+ recovered = attempt_node_recovery(symbol);
830
+ if (recovered) {
831
+ activeNodes = recovered;
832
+ }
833
+ else {
834
+ throw new Error("No active nodes available for ".concat(symbol));
835
+ }
830
836
  }
831
837
  log.info(tag, "Attempting broadcast for ".concat(symbol, " with ").concat(activeNodes.length, " nodes available"));
832
838
  MAX_RETRIES = 3;
@@ -1032,7 +1038,7 @@ var get_transaction = function (coin, txid) {
1032
1038
  // Enhanced UTXO function with priority-based sequential failover
1033
1039
  var get_utxos_by_xpub = function (coin, xpub) {
1034
1040
  return __awaiter(this, void 0, void 0, function () {
1035
- var tag, symbol, isBitcoin, b58, data, payload, xpubPrefix, convertedData, convertedXpub, nodes_3, activeNodes, i, node, startTime, url, body, resp, responseTime, error_3, responseTime, errorMessage, e_10;
1041
+ var tag, symbol, isBitcoin, b58, data, payload, xpubPrefix, convertedData, convertedXpub, nodes_3, activeNodes, recovered, i, node, startTime, url, body, resp, responseTime, error_3, responseTime, errorMessage, e_10;
1036
1042
  var _a;
1037
1043
  return __generator(this, function (_b) {
1038
1044
  switch (_b.label) {
@@ -1070,7 +1076,13 @@ var get_utxos_by_xpub = function (coin, xpub) {
1070
1076
  }
1071
1077
  activeNodes = nodes_3.filter(function (n) { return n.isActive; }).sort(function (a, b) { return a.priority - b.priority; });
1072
1078
  if (activeNodes.length === 0) {
1073
- throw new Error("No active nodes available for ".concat(symbol));
1079
+ recovered = attempt_node_recovery(symbol);
1080
+ if (recovered) {
1081
+ activeNodes = recovered;
1082
+ }
1083
+ else {
1084
+ throw new Error("No active nodes available for ".concat(symbol));
1085
+ }
1074
1086
  }
1075
1087
  log.info(tag, "Attempting UTXO query for ".concat(symbol, " with ").concat(activeNodes.length, " nodes available"));
1076
1088
  if (isBitcoin) {
@@ -1213,6 +1225,29 @@ var update_node_performance = function (coin, url, success, responseTime) {
1213
1225
  log.info("Auto-reordered ".concat(symbol, " nodes based on performance"));
1214
1226
  }
1215
1227
  };
1228
+ /**
1229
+ * Auto-recovery: When ALL nodes for a coin are inactive, reset them so the coin
1230
+ * isn't permanently dead. Inactive nodes can never receive requests to prove they're
1231
+ * healthy again, so this breaks the deadlock by giving them another chance.
1232
+ * Returns the recovered nodes sorted by priority, or null if no recovery was needed/possible.
1233
+ */
1234
+ var attempt_node_recovery = function (symbol) {
1235
+ var nodes = BLOCKBOOK_NODES[symbol];
1236
+ if (!nodes || nodes.length === 0)
1237
+ return null;
1238
+ var activeNodes = nodes.filter(function (n) { return n.isActive; });
1239
+ if (activeNodes.length > 0)
1240
+ return null; // Still have active nodes, no recovery needed
1241
+ log.warn("[AUTO-RECOVERY] All ".concat(nodes.length, " nodes for ").concat(symbol, " are inactive \u2014 resetting for retry"));
1242
+ for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
1243
+ var node = nodes_4[_i];
1244
+ node.isActive = true;
1245
+ node.consecutiveFailures = 0;
1246
+ log.info("[AUTO-RECOVERY] Reset node ".concat(node.url, " for ").concat(symbol));
1247
+ }
1248
+ update_legacy_urls(symbol);
1249
+ return nodes.sort(function (a, b) { return a.priority - b.priority; });
1250
+ };
1216
1251
  var get_balance_by_xpub = function (coin, xpub) {
1217
1252
  return __awaiter(this, void 0, void 0, function () {
1218
1253
  var tag, result, output, nodeUrl, balance, i, uxto, e_11;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/blockbook",
3
- "version": "8.38.5",
3
+ "version": "8.38.8",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "dependencies": {
@@ -14,10 +14,10 @@
14
14
  "request": "^2.88.2",
15
15
  "request-promise-native": "^1.0.9",
16
16
  "ws": "^8.18.0",
17
- "@pioneer-platform/loggerdog": "8.11.0",
18
- "@pioneer-platform/pioneer-nodes": "8.37.5",
19
17
  "@pioneer-platform/utxo-crypto": "8.11.0",
20
- "@pioneer-platform/pioneer-caip": "9.27.5"
18
+ "@pioneer-platform/pioneer-caip": "9.27.5",
19
+ "@pioneer-platform/loggerdog": "8.11.0",
20
+ "@pioneer-platform/pioneer-nodes": "8.37.5"
21
21
  },
22
22
  "keywords": [
23
23
  "bitcoin",