From 2222455565c9ee1b043355d520d666796bdb2dc9 Mon Sep 17 00:00:00 2001 From: myxmaster Date: Wed, 22 Nov 2023 20:42:25 +0100 Subject: [PATCH] fixed exception in getOutpoint when output_details are missing (CLN) --- models/Transaction.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/models/Transaction.ts b/models/Transaction.ts index d1b0290cc..bd647e3cf 100644 --- a/models/Transaction.ts +++ b/models/Transaction.ts @@ -118,11 +118,11 @@ export default class Transaction extends BaseModel { } @computed public get getOutpoint(): string { - let outpoint = ''; - this.output_details.map((output: OutputDetail) => { - if (output.is_our_address) - outpoint = `${this.tx}:${output.output_index}`; - }); - return outpoint; + const lastOutputWithOurAddress = this.output_details + ?.filter((d) => d.is_our_address) + .at(-1); + return lastOutputWithOurAddress != null + ? `${this.tx}:${lastOutputWithOurAddress.output_index}` + : ''; } }