Browse Source

spv, zero conf tx fix

v0.25
pbca26 7 years ago
parent
commit
50466ea8f9
  1. 4
      routes/shepherd/electrum/listunspent.js
  2. 10
      routes/shepherd/electrum/transactions.js

4
routes/shepherd/electrum/listunspent.js

@ -61,7 +61,7 @@ module.exports = (shepherd) => {
amountSats: _utxoItem.value,
interest: interest,
interestSats: Math.floor(interest * 100000000),
confirmations: currentHeight - _utxoItem.height,
confirmations: Number(_utxoItem.height) === 0 ? 0 : currentHeight - _utxoItem.height,
spendable: true,
verified: false,
};
@ -87,7 +87,7 @@ module.exports = (shepherd) => {
address,
amount: Number(_utxoItem.value) * 0.00000001,
amountSats: _utxoItem.value,
confirmations: currentHeight - _utxoItem.height,
confirmations: Number(_utxoItem.height) === 0 ? 0 : currentHeight - _utxoItem.height,
spendable: true,
verified: false,
};

10
routes/shepherd/electrum/transactions.js

@ -107,8 +107,8 @@ module.exports = (shepherd) => {
inputs: txInputs,
outputs: decodedTx.outputs,
height: transaction.height,
timestamp: blockInfo.timestamp,
confirmations: currentHeight - transaction.height,
timestamp: Number(transaction.height) === 0 ? Math.floor(Date.now() / 1000) : blockInfo.timestamp,
confirmations: Number(transaction.height) === 0 ? 0 : currentHeight - transaction.height,
};
const formattedTx = shepherd.parseTransactionAddresses(_parsedTx, req.query.address, network);
@ -149,8 +149,8 @@ module.exports = (shepherd) => {
inputs: 'cant parse',
outputs: 'cant parse',
height: transaction.height,
timestamp: blockInfo.timestamp,
confirmations: currentHeight - transaction.height,
timestamp: Number(transaction.height) === 0 ? Math.floor(Date.now() / 1000) : blockInfo.timestamp,
confirmations: Number(transaction.height) === 0 ? 0 : currentHeight - transaction.height,
};
const formattedTx = shepherd.parseTransactionAddresses(_parsedTx, req.query.address, network);
@ -166,7 +166,7 @@ module.exports = (shepherd) => {
outputs: 'cant parse',
height: transaction.height,
timestamp: 'cant get block info',
confirmations: currentHeight - transaction.height,
confirmations: Number(transaction.height) === 0 ? 0 : currentHeight - transaction.height,
};
const formattedTx = shepherd.parseTransactionAddresses(_parsedTx, req.query.address, network);
_rawtx.push(formattedTx);

Loading…
Cancel
Save