Skip to content

Commit

Permalink
Merge pull request #13 from bitcoinerlab/mempool-blockheight-0
Browse files Browse the repository at this point in the history
fix: use 0 for mempool blockheight accross all implementations
  • Loading branch information
landabaso authored Sep 20, 2024
2 parents 9c18d03 + 9057f53 commit 471f760
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@bitcoinerlab/explorer",
"description": "Bitcoin Blockchain Explorer: Client Interface featuring Esplora and Electrum Implementations.",
"homepage": "https://github.com/bitcoinerlab/explorer",
"version": "0.3.2",
"version": "0.3.3",
"author": "Jose-Luis Landabaso",
"license": "MIT",
"prettier": "@bitcoinerlab/configs/prettierConfig.json",
Expand Down
5 changes: 4 additions & 1 deletion src/electrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,10 @@ export class ElectrumExplorer implements Explorer {

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

0 comments on commit 471f760

Please sign in to comment.