Merge pull request #5904 from mempool/mononaut/sighash-fixes

misc signature highlighting fixes
This commit is contained in:
wiz
2025-05-09 02:17:26 -10:00
committed by GitHub
4 changed files with 18 additions and 15 deletions

View File

@@ -58,11 +58,11 @@
@if (tx['_showSignatures']) {
<td class="sig-td">
<div class="sig-stack">
@if (tx['_sigs'][vindex].length === 0 && signaturesMode === 'all') {
@if (!tx['_sigs']?.[vindex]?.length) {
<span class="sig sig-key sig-no-lock" ngbTooltip="unsigned">
<fa-icon [icon]="['fas', 'lock-open']" [fixedWidth]="true"></fa-icon>
</span>
} @else if (showSig(tx['_sigs'][vindex])) {
} @else {
@for (sig of tx['_sigs'][vindex].slice(0, 7); track sig.signature; let idx = $index) {
@if (idx < 7) {
<span

View File

@@ -91,13 +91,13 @@ export class TransactionsListComponent implements OnInit, OnChanges, OnDestroy {
ngOnInit(): void {
this.latestBlock$ = this.stateService.blocks$.pipe(map((blocks) => blocks[0]));
this.networkSubscription = this.stateService.networkChanged$.subscribe((network) => this.network = network);
this.signaturesSubscription = this.stateService.signaturesMode$.subscribe((mode) => {
this.signaturesMode = mode;
this.signaturesPreference = mode;
this.updateSignaturesMode();
});
this.queryParamsSubscription = this.route.queryParams.subscribe((params) => {
console.log('query params', params);
if (params['sigs'] && ['all', 'interesting', 'none'].includes(params['sigs'])) {
this.signaturesOverride = params['sigs'] as SignaturesMode;
this.updateSignaturesMode();
@@ -313,16 +313,19 @@ export class TransactionsListComponent implements OnInit, OnChanges, OnDestroy {
}
// process signature data
tx['_sigs'] = tx.vin.map(vin => processInputSignatures(vin));
tx['_sigmap'] = tx['_sigs'].reduce((map, sigs, vindex) => {
sigs.forEach(sig => {
map[sig.signature] = { sig, vindex };
});
return map;
}, {});
if (tx.vin.length && !tx.vin[0].is_coinbase) {
tx['_sigs'] = tx.vin.map(vin => processInputSignatures(vin));
tx['_sigmap'] = tx['_sigs'].reduce((map, sigs, vindex) => {
sigs.forEach(sig => {
map[sig.signature] = { sig, vindex };
});
return map;
}, {});
if (!tx['_interestingSignatures']) {
tx['_interestingSignatures'] = tx['_sigs'].some(sigs => sigs.some(sig => this.sigIsInteresting(sig)));
if (!tx['_interestingSignatures']) {
tx['_interestingSignatures'] = tx['_sigs'].some(sigs => sigs.some(sig => this.sigIsInteresting(sig)))
|| tx['_sigs'].every(sigs => !sigs?.length);
}
}
tx['_showSignatures'] = this.shouldShowSignatures(tx);
}

View File

@@ -335,7 +335,7 @@ export class StateService {
this.blocksSubject$.next([]);
});
this.signaturesMode$ = new BehaviorSubject<SignaturesMode>(this.storageService.getValue('signatures-enabled') as SignaturesMode || null);
this.signaturesMode$ = new BehaviorSubject<SignaturesMode>(this.storageService.getValue('signatures-mode') as SignaturesMode || null);
this.blockVSize = this.env.BLOCK_WEIGHT_UNITS / 4;

View File

@@ -235,7 +235,7 @@ export function processInputSignatures(vin: Vin): SigInfo[] {
signatures = extractDERSignaturesWitness(vin.witness || []);
break;
case 'v1_p2tr': {
const hasAnnex = vin.witness[vin.witness.length - 1].startsWith('50');
const hasAnnex = vin.witness.length > 1 &&vin.witness[vin.witness.length - 1].startsWith('50');
const isKeyspend = vin.witness.length === (hasAnnex ? 2 : 1);
if (isKeyspend) {
signatures = extractSchnorrSignatures(vin.witness);