never show a utxo chart with missing data

This commit is contained in:
Mononaut 2024-10-06 15:21:41 +00:00
parent 8808ff1a98
commit 8e223861d6
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -219,11 +219,11 @@ export class AddressComponent implements OnInit, OnDestroy {
address.is_pubkey
? this.electrsApiService.getScriptHashTransactions$((address.address.length === 66 ? '21' : '41') + address.address + 'ac')
: this.electrsApiService.getAddressTransactions$(address.address),
(utxoCount >= 2 && utxoCount <= 500 ? (address.is_pubkey
(utxoCount > 2 && utxoCount <= 500 ? (address.is_pubkey
? this.electrsApiService.getScriptHashUtxos$((address.address.length === 66 ? '21' : '41') + address.address + 'ac')
: this.electrsApiService.getAddressUtxos$(address.address)) : of([])).pipe(
: this.electrsApiService.getAddressUtxos$(address.address)) : of(null)).pipe(
catchError(() => {
return of([]);
return of(null);
})
)
]);
@ -350,6 +350,7 @@ export class AddressComponent implements OnInit, OnDestroy {
}
// update utxos in-place
if (this.utxos != null) {
let utxosChanged = false;
for (const vin of transaction.vin) {
const utxoIndex = this.utxos.findIndex((utxo) => utxo.txid === vin.txid && utxo.vout === vin.vout);
@ -372,6 +373,7 @@ export class AddressComponent implements OnInit, OnDestroy {
if (utxosChanged) {
this.utxos = this.utxos.slice();
}
}
return true;
}
@ -385,6 +387,7 @@ export class AddressComponent implements OnInit, OnDestroy {
this.transactions = this.transactions.slice();
// update utxos in-place
if (this.utxos != null) {
let utxosChanged = false;
for (const vin of transaction.vin) {
if (vin.prevout?.scriptpubkey_address === this.address.address) {
@ -409,12 +412,14 @@ export class AddressComponent implements OnInit, OnDestroy {
if (utxosChanged) {
this.utxos = this.utxos.slice();
}
}
return true;
}
confirmTransaction(transaction: Transaction): void {
// update utxos in-place
if (this.utxos != null) {
let utxosChanged = false;
for (const vin of transaction.vin) {
if (vin.prevout?.scriptpubkey_address === this.address.address) {
@ -438,6 +443,7 @@ export class AddressComponent implements OnInit, OnDestroy {
this.utxos = this.utxos.slice();
}
}
}
loadMore(): void {
if (this.isLoadingTransactions || this.fullyLoaded) {