Skip to content

Commit

Permalink
fixed exception in getOutpoint when output_details are missing (CLN)
Browse files Browse the repository at this point in the history
  • Loading branch information
myxmaster committed Nov 22, 2023
1 parent 02fe366 commit 2222455
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions models/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
: '';
}
}

0 comments on commit 2222455

Please sign in to comment.