Skip to content

Commit

Permalink
fix: allow descriptor self sends
Browse files Browse the repository at this point in the history
Update filter to exclude self-sends from changeOutputs

Ticket: BTC-1791

TICKET: BTC-1791
  • Loading branch information
lcovar committed Feb 5, 2025
1 parent 7bad535 commit 8930d3b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/abstract-utxo/src/transaction/descriptor/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ function parseOutputsWithPsbt(
recipientOutputs: RecipientOutput[]
): ParsedOutputs {
const parsed = coreDescriptors.parse(psbt, descriptorMap, psbt.network);
const changeOutputs = parsed.outputs.filter((o) => o.scriptId !== undefined);
const changeOutputs = parsed.outputs.filter(
(o) => o.scriptId !== undefined && !recipientOutputs.some((r) => r.address === o.address)
);
const outputDiffs = outputDifferencesWithExpected(parsed.outputs, recipientOutputs);
return {
outputs: parsed.outputs,
Expand Down

0 comments on commit 8930d3b

Please sign in to comment.