@dignetwork/dig-sdk 0.0.1-alpha.114 → 0.0.1-alpha.116
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoreInfoCacheUpdater.d.ts","sourceRoot":"","sources":["../../src/blockchain/StoreInfoCacheUpdater.ts"],"names":[],"mappings":"AAaA,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAwB;IAC/C,OAAO,CAAC,cAAc,CAInB;IACH,OAAO,CAAC,QAAQ,CAAyC;IACzD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,WAAW,CAAsC;IACzD,OAAO,CAAC,YAAY,CAAiB;IAErC,OAAO;WAeO,YAAY,IAAI,qBAAqB;YAQrC,aAAa;
|
|
1
|
+
{"version":3,"file":"StoreInfoCacheUpdater.d.ts","sourceRoot":"","sources":["../../src/blockchain/StoreInfoCacheUpdater.ts"],"names":[],"mappings":"AAaA,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAwB;IAC/C,OAAO,CAAC,cAAc,CAInB;IACH,OAAO,CAAC,QAAQ,CAAyC;IACzD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,WAAW,CAAsC;IACzD,OAAO,CAAC,YAAY,CAAiB;IAErC,OAAO;WAeO,YAAY,IAAI,qBAAqB;YAQrC,aAAa;YAwDb,YAAY;IAyH1B,OAAO,CAAC,oBAAoB;CAM7B"}
|
|
@@ -42,10 +42,10 @@ class StoreInfoCacheUpdater {
|
|
|
42
42
|
this.isMonitoring = true;
|
|
43
43
|
this.storeCoinCache = new utils_1.FileCache(`stores`, utils_1.USER_DIR_PATH);
|
|
44
44
|
// Construct lock file path using the path module
|
|
45
|
-
this.lockFilePath = path.join(utils_1.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
fs_1.default.
|
|
45
|
+
this.lockFilePath = path.join(utils_1.USER_DIR_PATH, "store-info-cache.lock");
|
|
46
|
+
const lockDir = path.dirname(this.lockFilePath);
|
|
47
|
+
if (!fs_1.default.existsSync(lockDir)) {
|
|
48
|
+
fs_1.default.mkdirSync(lockDir, { recursive: true });
|
|
49
49
|
}
|
|
50
50
|
// Start monitors for existing storeIds
|
|
51
51
|
this.startMonitors();
|
|
@@ -85,6 +85,7 @@ class StoreInfoCacheUpdater {
|
|
|
85
85
|
this.monitors.set(storeId, monitorPromise);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
+
this.isMonitoring = true;
|
|
88
89
|
// Wait for all monitors to settle
|
|
89
90
|
const monitorPromises = Array.from(this.monitors.values());
|
|
90
91
|
await Promise.all(monitorPromises);
|
|
@@ -110,6 +111,7 @@ class StoreInfoCacheUpdater {
|
|
|
110
111
|
while (this.isMonitoring) {
|
|
111
112
|
let peer = null;
|
|
112
113
|
try {
|
|
114
|
+
console.log(`Monitoring store ${storeId}`);
|
|
113
115
|
// Connect to a peer
|
|
114
116
|
peer = await (0, utils_2.withTimeout)(FullNodePeer_1.FullNodePeer.connect(), 60000, "Timeout connecting to FullNodePeer");
|
|
115
117
|
// Get the latest store info (from cache if available)
|
|
@@ -128,7 +130,7 @@ class StoreInfoCacheUpdater {
|
|
|
128
130
|
});
|
|
129
131
|
// Get the coinId associated with the store
|
|
130
132
|
const coinId = (0, datalayer_driver_1.getCoinId)(latestStore.coin);
|
|
131
|
-
console.log(
|
|
133
|
+
console.log(`!!! Waiting for coin to be spent: ${coinId.toString("hex")}`);
|
|
132
134
|
// Wait for the coin to be spent
|
|
133
135
|
await peer.waitForCoinToBeSpent(coinId, latestHeight, Buffer.from(latestHash, "hex"));
|
|
134
136
|
console.log(`Detected Coin Spend: ${coinId.toString("hex")}`);
|