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