Browse Source
Merge pull request #982 from BlueWallet/fix-965
FIX: negative confirmation num for electrum personal server (closes #…
receivehooks
Overtorment
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
1 deletions
-
BlueElectrum.js
|
|
@ -364,6 +364,10 @@ module.exports.multiGetTransactionByTxid = async function(txids, batchsize, verb |
|
|
|
if (txhashHeightCache[txid]) { |
|
|
|
// got blockheight where this tx was confirmed
|
|
|
|
tx.confirmations = this.estimateCurrentBlockheight() - txhashHeightCache[txid]; |
|
|
|
if (tx.confirmations < 0) { |
|
|
|
// ugly fix for when estimator lags behind
|
|
|
|
tx.confirmations = 1; |
|
|
|
} |
|
|
|
tx.time = this.calculateBlockTime(txhashHeightCache[txid]); |
|
|
|
tx.blocktime = this.calculateBlockTime(txhashHeightCache[txid]); |
|
|
|
} |
|
|
@ -463,7 +467,7 @@ module.exports.broadcastV2 = async function(hex) { |
|
|
|
|
|
|
|
module.exports.estimateCurrentBlockheight = function() { |
|
|
|
const baseTs = 1585837504347; // uS
|
|
|
|
const baseHeight = 624083; |
|
|
|
const baseHeight = 624197; |
|
|
|
return Math.floor(baseHeight + (+new Date() - baseTs) / 1000 / 60 / 10); |
|
|
|
}; |
|
|
|
|
|
|
|