fix frontend js error on unconfirmed non-cpfp transactions

This commit is contained in:
Mononaut 2023-01-11 08:41:00 -06:00
parent bd30f2eb12
commit 2548d2a5e9
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -131,8 +131,11 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.cpfpInfo = null;
return;
}
const relatives = [...cpfpInfo.ancestors, ...cpfpInfo.descendants || [cpfpInfo.bestDescendant]];
// merge ancestors/descendants
const relatives = [...(cpfpInfo.ancestors || []), ...(cpfpInfo.descendants || [])];
if (cpfpInfo.bestDescendant && !cpfpInfo.descendants?.length) {
relatives.push(cpfpInfo.bestDescendant);
}
let totalWeight =
this.tx.weight +
relatives.reduce((prev, val) => prev + val.weight, 0);