Skip to content

Commit 471f760

Browse files
authored
Merge pull request #13 from bitcoinerlab/mempool-blockheight-0
fix: use 0 for mempool blockheight accross all implementations
2 parents 9c18d03 + 9057f53 commit 471f760

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@bitcoinerlab/explorer",
33
"description": "Bitcoin Blockchain Explorer: Client Interface featuring Esplora and Electrum Implementations.",
44
"homepage": "https://github.com/bitcoinerlab/explorer",
5-
"version": "0.3.2",
5+
"version": "0.3.3",
66
"author": "Jose-Luis Landabaso",
77
"license": "MIT",
88
"prettier": "@bitcoinerlab/configs/prettierConfig.json",

src/electrum.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,10 @@ export class ElectrumExplorer implements Explorer {
416416

417417
const transactionHistory = history.map(({ tx_hash, height }) => {
418418
const txId = tx_hash;
419-
const blockHeight: number = height || 0;
419+
//Electrum returns -1 for mempool, however we use blockHeight = 0 to
420+
//denote mempool
421+
const blockHeight: number =
422+
parseInt(height) === -1 ? 0 : parseInt(height);
420423
if (blockHeight > this.#tipBlockHeight) {
421424
console.warn(
422425
`tx ${tx_hash} block height ${blockHeight} larger than the tip ${this.#tipBlockHeight}`

0 commit comments

Comments
 (0)