fixes for non-dual-node rbf feature

This commit is contained in:
Mononaut 2023-03-04 03:16:59 -06:00
parent 723212c918
commit 6fb4adc27d
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
7 changed files with 31 additions and 24 deletions

View File

@ -438,7 +438,6 @@ class WebsocketHandler {
}
}
console.log(client['track-rbf']);
if (client['track-rbf'] === 'all' && rbfReplacements) {
response['rbfLatest'] = rbfReplacements;
} else if (client['track-rbf'] === 'fullRbf' && fullRbfReplacements) {

View File

@ -1,6 +1,6 @@
<div
#tooltip
*ngIf="rbfInfo"
*ngIf="rbfInfo && tooltipPosition !== null"
class="rbf-tooltip"
[style.left]="tooltipPosition.x + 'px'"
[style.top]="tooltipPosition.y + 'px'"

View File

@ -10,7 +10,7 @@ export class RbfTimelineTooltipComponent implements OnChanges {
@Input() rbfInfo: RbfInfo | void;
@Input() cursorPosition: { x: number, y: number };
tooltipPosition = { x: 0, y: 0 };
tooltipPosition = null;
@ViewChild('tooltip') tooltipElement: ElementRef<HTMLCanvasElement>;

View File

@ -23,7 +23,7 @@ export class RbfTimelineComponent implements OnInit, OnChanges {
rows: TimelineCell[][] = [];
hoverInfo: RbfInfo | void = null;
tooltipPosition = { x: 0, y: 0 };
tooltipPosition = null;
dir: 'rtl' | 'ltr' = 'ltr';

View File

@ -97,7 +97,7 @@
</tr>
</ng-template>
</ng-template>
<tr *ngIf="!replaced">
<tr *ngIf="!replaced && !isCached">
<td class="td-width" i18n="transaction.eta|Transaction ETA">ETA</td>
<td>
<ng-template [ngIf]="txInBlockIndex === undefined" [ngIfElse]="estimationTmpl">

View File

@ -170,7 +170,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.tx.effectiveFeePerVsize = totalFees / (totalWeight / 4);
if (!this.tx.status.confirmed) {
if (!this.tx?.status?.confirmed) {
this.stateService.markBlock$.next({
txFeePerVSize: this.tx.effectiveFeePerVsize,
});
@ -218,16 +218,15 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.error = undefined;
this.waitingForTransaction = false;
this.graphExpanded = false;
this.transactionTime = 0;
this.setupGraph();
if (!this.tx?.status?.confirmed) {
this.fetchRbfHistory$.next(this.tx.txid);
this.txRbfInfoSubscription = this.stateService.txRbfInfo$.subscribe((rbfInfo) => {
if (this.tx) {
this.rbfInfo = rbfInfo;
}
});
}
this.fetchRbfHistory$.next(this.tx.txid);
this.txRbfInfoSubscription = this.stateService.txRbfInfo$.subscribe((rbfInfo) => {
if (this.tx) {
this.rbfInfo = rbfInfo;
}
});
}
});
@ -268,7 +267,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
of(true),
this.stateService.connectionState$.pipe(
filter(
(state) => state === 2 && this.tx && !this.tx.status.confirmed
(state) => state === 2 && this.tx && !this.tx.status?.confirmed
)
)
);
@ -305,6 +304,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
)
.subscribe((tx: Transaction) => {
if (!tx) {
this.fetchCachedTx$.next(this.txId);
return;
}
@ -323,13 +323,17 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.graphExpanded = false;
this.setupGraph();
if (!tx.status.confirmed && tx.firstSeen) {
this.transactionTime = tx.firstSeen;
if (!tx.status?.confirmed) {
if (tx.firstSeen) {
this.transactionTime = tx.firstSeen;
} else {
this.transactionTime = 0;
}
} else {
this.getTransactionTime();
}
if (this.tx.status.confirmed) {
if (this.tx?.status?.confirmed) {
this.stateService.markBlock$.next({
blockHeight: tx.status.block_height,
});
@ -346,10 +350,10 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
} else {
this.fetchCpfp$.next(this.tx.txid);
}
this.fetchRbfHistory$.next(this.tx.txid);
}
this.fetchRbfHistory$.next(this.tx.txid);
this.priceService.getBlockPrice$(tx.status.block_time, true).pipe(
this.priceService.getBlockPrice$(tx.status?.block_time, true).pipe(
tap((price) => {
this.blockConversion = price;
})
@ -383,10 +387,12 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.error = new Error();
this.waitingForTransaction = false;
}
this.rbfTransaction = rbfTransaction;
this.replaced = true;
if (rbfTransaction && !this.tx) {
this.fetchCachedTx$.next(this.txId);
if (!this.tx?.status?.confirmed) {
this.rbfTransaction = rbfTransaction;
this.replaced = true;
if (rbfTransaction && !this.tx) {
this.fetchCachedTx$.next(this.txId);
}
}
});

View File

@ -43,6 +43,7 @@ export interface Env {
MAINNET_BLOCK_AUDIT_START_HEIGHT: number;
TESTNET_BLOCK_AUDIT_START_HEIGHT: number;
SIGNET_BLOCK_AUDIT_START_HEIGHT: number;
FULL_RBF_ENABLED: boolean;
HISTORICAL_PRICE: boolean;
}
@ -73,6 +74,7 @@ const defaultEnv: Env = {
'MAINNET_BLOCK_AUDIT_START_HEIGHT': 0,
'TESTNET_BLOCK_AUDIT_START_HEIGHT': 0,
'SIGNET_BLOCK_AUDIT_START_HEIGHT': 0,
'FULL_RBF_ENABLED': false,
'HISTORICAL_PRICE': true,
};