Skip to content

Commit

Permalink
fix: correct unsigned tx utxos on etna import tx builder
Browse files Browse the repository at this point in the history
  • Loading branch information
erictaylor committed Nov 27, 2024
1 parent 6e24237 commit ea9f31e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/vms/pvm/etna-builder/builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
);

expectTxs(unsignedTx.getTx(), expectedTx);

// Ensure that the unsigned tx utxos are the filtered utxos,
// and not the inputUtxos registered in the spend helper.
// This is only relevant for the ImportTx.
expect(unsignedTx.utxos).toHaveLength(2);
expect(unsignedTx.utxos).not.toContain(utxos[1]);
});

test('newExportTx', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/vms/pvm/etna-builder/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ export const newImportTx: TxBuilderFn<NewImportTxProps> = (
context,
);

const { changeOutputs, inputs, inputUTXOs } = spendResults;
const { changeOutputs, inputs } = spendResults;

return new UnsignedTx(
new ImportTx(
Expand All @@ -411,7 +411,7 @@ export const newImportTx: TxBuilderFn<NewImportTxProps> = (
Id.fromString(sourceChainId),
importedInputs.sort(TransferableInput.compare),
),
inputUTXOs,
filteredUtxos,
addressMaps,
);
};
Expand Down

0 comments on commit ea9f31e

Please sign in to comment.