From 2548d2a5e9add8f72d108c4c125b1a88e051f230 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Wed, 11 Jan 2023 08:41:00 -0600 Subject: [PATCH] fix frontend js error on unconfirmed non-cpfp transactions --- .../app/components/transaction/transaction.component.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index 81ae2f055..e01092189 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -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);