btcrelay-bitcoind
Advanced tools
Comparing version 5.0.3 to 5.0.4
@@ -43,5 +43,9 @@ "use strict"; | ||
const computedHeaderMap = {}; | ||
let forkFee; | ||
let mainFee; | ||
const saveHeaders = (headerCache, final) => __awaiter(this, void 0, void 0, function* () { | ||
console.log("[BtcRelaySynchronizer]: Header cache: ", headerCache.map(e => e.hash)); | ||
if (cacheData.forkId === -1) { | ||
if (mainFee == null) | ||
mainFee = yield this.btcRelay.getMainFeeRate(); | ||
if (final && | ||
@@ -51,12 +55,16 @@ this.btcRelay.maxShortForkHeadersPerTx != null && | ||
this.btcRelay.saveShortForkHeaders != null) { | ||
cacheData = yield this.btcRelay.saveShortForkHeaders(headerCache, cacheData.lastStoredHeader, tipData.chainWork); | ||
cacheData = yield this.btcRelay.saveShortForkHeaders(headerCache, cacheData.lastStoredHeader, tipData.chainWork, mainFee); | ||
} | ||
else { | ||
cacheData = yield this.btcRelay.saveNewForkHeaders(headerCache, cacheData.lastStoredHeader, tipData.chainWork); | ||
cacheData = yield this.btcRelay.saveNewForkHeaders(headerCache, cacheData.lastStoredHeader, tipData.chainWork, mainFee); | ||
} | ||
} | ||
else if (cacheData.forkId === 0) { | ||
cacheData = yield this.btcRelay.saveMainHeaders(headerCache, cacheData.lastStoredHeader); | ||
if (mainFee == null) | ||
mainFee = yield this.btcRelay.getMainFeeRate(); | ||
cacheData = yield this.btcRelay.saveMainHeaders(headerCache, cacheData.lastStoredHeader, mainFee); | ||
} | ||
else { | ||
if (forkFee == null) | ||
forkFee = yield this.btcRelay.getForkFeeRate(cacheData.forkId); | ||
cacheData = yield this.btcRelay.saveForkHeaders(headerCache, cacheData.lastStoredHeader, cacheData.forkId, tipData.chainWork); | ||
@@ -63,0 +71,0 @@ } |
{ | ||
"name": "btcrelay-bitcoind", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"description": "Connector and synchronizer using bitcoind for bitcoin relay", | ||
@@ -29,3 +29,3 @@ "main": "./dist/index.js", | ||
"bn.js": "5.2.1", | ||
"crosslightning-base": "6.0.1" | ||
"crosslightning-base": "6.0.2" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
@@ -62,5 +62,9 @@ | ||
let forkFee: string; | ||
let mainFee: string; | ||
const saveHeaders = async (headerCache: BitcoindBlock[], final: boolean) => { | ||
console.log("[BtcRelaySynchronizer]: Header cache: ", headerCache.map(e => e.hash)); | ||
if(cacheData.forkId===-1) { | ||
if(mainFee==null) mainFee = await this.btcRelay.getMainFeeRate(); | ||
if( | ||
@@ -72,10 +76,12 @@ final && | ||
) { | ||
cacheData = await this.btcRelay.saveShortForkHeaders(headerCache, cacheData.lastStoredHeader, tipData.chainWork); | ||
cacheData = await this.btcRelay.saveShortForkHeaders(headerCache, cacheData.lastStoredHeader, tipData.chainWork, mainFee); | ||
} else { | ||
cacheData = await this.btcRelay.saveNewForkHeaders(headerCache, cacheData.lastStoredHeader, tipData.chainWork); | ||
cacheData = await this.btcRelay.saveNewForkHeaders(headerCache, cacheData.lastStoredHeader, tipData.chainWork, mainFee); | ||
} | ||
} else if(cacheData.forkId===0) { | ||
cacheData = await this.btcRelay.saveMainHeaders(headerCache, cacheData.lastStoredHeader); | ||
if(mainFee==null) mainFee = await this.btcRelay.getMainFeeRate(); | ||
cacheData = await this.btcRelay.saveMainHeaders(headerCache, cacheData.lastStoredHeader, mainFee); | ||
} else { | ||
cacheData = await this.btcRelay.saveForkHeaders(headerCache, cacheData.lastStoredHeader, cacheData.forkId, tipData.chainWork) | ||
if(forkFee==null) forkFee = await this.btcRelay.getForkFeeRate(cacheData.forkId); | ||
cacheData = await this.btcRelay.saveForkHeaders(headerCache, cacheData.lastStoredHeader, cacheData.forkId, tipData.chainWork); | ||
} | ||
@@ -82,0 +88,0 @@ if(cacheData.forkId!==-1 && cacheData.forkId!==0) startForkId = cacheData.forkId; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52510
1032
+ Addedcrosslightning-base@6.0.2(transitive)
- Removedcrosslightning-base@6.0.1(transitive)
Updatedcrosslightning-base@6.0.2