frontend support for v1 block audits
This commit is contained in:
parent
7cc01af631
commit
67761230e3
@ -521,6 +521,7 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
if (transactions && blockAudit) {
|
if (transactions && blockAudit) {
|
||||||
const inTemplate = {};
|
const inTemplate = {};
|
||||||
const inBlock = {};
|
const inBlock = {};
|
||||||
|
const isUnseen = {};
|
||||||
const isAdded = {};
|
const isAdded = {};
|
||||||
const isPrioritized = {};
|
const isPrioritized = {};
|
||||||
const isCensored = {};
|
const isCensored = {};
|
||||||
@ -543,6 +544,9 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
for (const tx of transactions) {
|
for (const tx of transactions) {
|
||||||
inBlock[tx.txid] = true;
|
inBlock[tx.txid] = true;
|
||||||
}
|
}
|
||||||
|
for (const txid of blockAudit.unseenTxs || []) {
|
||||||
|
isUnseen[txid] = true;
|
||||||
|
}
|
||||||
for (const txid of blockAudit.addedTxs) {
|
for (const txid of blockAudit.addedTxs) {
|
||||||
isAdded[txid] = true;
|
isAdded[txid] = true;
|
||||||
}
|
}
|
||||||
@ -592,18 +596,23 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
tx.status = 'accelerated';
|
tx.status = 'accelerated';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const [index, tx] of transactions.entries()) {
|
let anySeen = false;
|
||||||
|
for (let index = transactions.length - 1; index >= 0; index--) {
|
||||||
|
const tx = transactions[index];
|
||||||
tx.context = 'actual';
|
tx.context = 'actual';
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
tx.status = null;
|
tx.status = null;
|
||||||
} else if (isAdded[tx.txid]) {
|
|
||||||
tx.status = 'added';
|
|
||||||
} else if (isPrioritized[tx.txid]) {
|
} else if (isPrioritized[tx.txid]) {
|
||||||
tx.status = 'prioritized';
|
tx.status = 'prioritized';
|
||||||
|
} else if (isAdded[tx.txid] && (blockAudit.version === 0 || isUnseen[tx.txid])) {
|
||||||
|
tx.status = 'added';
|
||||||
} else if (inTemplate[tx.txid]) {
|
} else if (inTemplate[tx.txid]) {
|
||||||
|
anySeen = true;
|
||||||
tx.status = 'found';
|
tx.status = 'found';
|
||||||
} else if (isRbf[tx.txid]) {
|
} else if (isRbf[tx.txid]) {
|
||||||
tx.status = 'rbf';
|
tx.status = 'rbf';
|
||||||
|
} else if (isUnseen[tx.txid] && anySeen) {
|
||||||
|
tx.status = 'added';
|
||||||
} else {
|
} else {
|
||||||
tx.status = 'selected';
|
tx.status = 'selected';
|
||||||
isSelected[tx.txid] = true;
|
isSelected[tx.txid] = true;
|
||||||
|
@ -411,10 +411,11 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
const isConflict = audit.fullrbfTxs.includes(txid);
|
const isConflict = audit.fullrbfTxs.includes(txid);
|
||||||
const isExpected = audit.template.some(tx => tx.txid === txid);
|
const isExpected = audit.template.some(tx => tx.txid === txid);
|
||||||
const firstSeen = audit.template.find(tx => tx.txid === txid)?.time;
|
const firstSeen = audit.template.find(tx => tx.txid === txid)?.time;
|
||||||
|
const wasSeen = audit.version === 1 ? !audit.unseenTxs.includes(txid) : (isExpected || isPrioritized || isAccelerated);
|
||||||
return {
|
return {
|
||||||
seen: isExpected || isPrioritized || isAccelerated,
|
seen: wasSeen,
|
||||||
expected: isExpected,
|
expected: isExpected,
|
||||||
added: isAdded,
|
added: isAdded && (audit.version === 0 || !wasSeen),
|
||||||
prioritized: isPrioritized,
|
prioritized: isPrioritized,
|
||||||
conflict: isConflict,
|
conflict: isConflict,
|
||||||
accelerated: isAccelerated,
|
accelerated: isAccelerated,
|
||||||
|
@ -211,6 +211,8 @@ export interface BlockExtended extends Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface BlockAudit extends BlockExtended {
|
export interface BlockAudit extends BlockExtended {
|
||||||
|
version: number,
|
||||||
|
unseenTxs?: string[],
|
||||||
missingTxs: string[],
|
missingTxs: string[],
|
||||||
addedTxs: string[],
|
addedTxs: string[],
|
||||||
prioritizedTxs: string[],
|
prioritizedTxs: string[],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user