Skip to content

Commit

Permalink
Remove blockCount dependency from Activity.vue
Browse files Browse the repository at this point in the history
  • Loading branch information
panleone committed Oct 14, 2024
1 parent 379338e commit 25edc58
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
8 changes: 1 addition & 7 deletions scripts/dashboard/Activity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { beautifyNumber } from '../misc';
import iCheck from '../../assets/icons/icon-check.svg';
import iHourglass from '../../assets/icons/icon-hourglass.svg';
import { blockCount } from '../global.js';
const props = defineProps({
title: String,
Expand Down Expand Up @@ -175,11 +174,6 @@ async function parseTXs(arrTXs) {
// Update the time cache
prevTimestamp = cTx.time * 1000;
// Coinbase Transactions (rewards) require coinbaseMaturity confs
const fConfirmed =
blockCount - cTx.blockHeight >=
(props.rewards ? cChainParams.current.coinbaseMaturity : 6);
// Choose the content type, for the Dashboard; use a generative description, otherwise, a TX-ID
// let txContent = props.rewards ? cTx.id : 'Block Reward';
Expand Down Expand Up @@ -248,7 +242,7 @@ async function parseTXs(arrTXs) {
content: props.rewards ? cTx.id : content,
formattedAmt,
amount: cTx.amount,
confirmed: fConfirmed,
confirmed: cTx.isConfirmed,
icon,
colour,
});
Expand Down
5 changes: 4 additions & 1 deletion scripts/historical_tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class HistoricalTx {
* @param {number} time - The block time of the transaction.
* @param {number} blockHeight - The block height of the transaction.
* @param {number} amount - The amount transacted, in coins.
* @param {boolean} isConfirmed - Whether the transaction has been confirmed.
*/
constructor(
type,
Expand All @@ -18,7 +19,8 @@ export class HistoricalTx {
shieldedOutputs,
time,
blockHeight,
amount
amount,
isConfirmed
) {
this.type = type;
this.id = id;
Expand All @@ -27,6 +29,7 @@ export class HistoricalTx {
this.time = time;
this.blockHeight = blockHeight;
this.amount = amount;
this.isConfirmed = isConfirmed;
}
}

Expand Down
7 changes: 6 additions & 1 deletion scripts/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,10 @@ export class Wallet {
} else if (nAmount < 0) {
type = HistoricalTxType.SENT;
}
const isCoinSpecial = tx.isCoinStake() || tx.isCoinBase();
const isConfirmed =
blockCount - tx.blockHeight >=
(isCoinSpecial ? cChainParams.current.coinbaseMaturity : 6);

histTXs.push(
new HistoricalTx(
Expand All @@ -675,7 +679,8 @@ export class Wallet {
false,
tx.blockTime,
tx.blockHeight,
Math.abs(nAmount)
Math.abs(nAmount),
isConfirmed
)
);
}
Expand Down

0 comments on commit 25edc58

Please sign in to comment.