@dignetwork/dig-sdk 0.0.1-alpha.112 → 0.0.1-alpha.114
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":"
|
|
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;YAsDb,YAAY;IAwH1B,OAAO,CAAC,oBAAoB;CAM7B"}
|
|
@@ -22,8 +22,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.StoreInfoCacheUpdater = void 0;
|
|
30
|
+
const fs_1 = __importDefault(require("fs"));
|
|
27
31
|
const FullNodePeer_1 = require("./FullNodePeer");
|
|
28
32
|
const utils_1 = require("../utils");
|
|
29
33
|
const DataStoreSerializer_1 = require("./DataStoreSerializer");
|
|
@@ -39,6 +43,10 @@ class StoreInfoCacheUpdater {
|
|
|
39
43
|
this.storeCoinCache = new utils_1.FileCache(`stores`, utils_1.USER_DIR_PATH);
|
|
40
44
|
// Construct lock file path using the path module
|
|
41
45
|
this.lockFilePath = path.join(utils_1.DIG_FOLDER_PATH, "store-info-cache.lock");
|
|
46
|
+
if (fs_1.default.existsSync(this.lockFilePath)) {
|
|
47
|
+
console.log("Removing existing lock file");
|
|
48
|
+
fs_1.default.unlinkSync(this.lockFilePath);
|
|
49
|
+
}
|
|
42
50
|
// Start monitors for existing storeIds
|
|
43
51
|
this.startMonitors();
|
|
44
52
|
}
|
|
@@ -120,8 +128,10 @@ class StoreInfoCacheUpdater {
|
|
|
120
128
|
});
|
|
121
129
|
// Get the coinId associated with the store
|
|
122
130
|
const coinId = (0, datalayer_driver_1.getCoinId)(latestStore.coin);
|
|
131
|
+
console.log(`Waiting for coin to be spent: ${coinId.toString("hex")}`);
|
|
123
132
|
// Wait for the coin to be spent
|
|
124
133
|
await peer.waitForCoinToBeSpent(coinId, latestHeight, Buffer.from(latestHash, "hex"));
|
|
134
|
+
console.log(`Detected Coin Spend: ${coinId.toString("hex")}`);
|
|
125
135
|
let updatedStore, newHeight;
|
|
126
136
|
try {
|
|
127
137
|
// When resolved, sync the store
|