Skip to content

Commit 29ba8d3

Browse files
OttoAllmendingerllm-git
andcommitted
feat(utxo-lib): add finalized input data to PSBT fixtures
Add `psbtInputsFinalized` property to PSBT fixtures that shows the state of inputs after finalization but before extraction to a raw transaction. This will help with debugging and testing PSBT finalization. Issue: BTC-2652 Co-authored-by: llm-git <[email protected]>
1 parent 6ff09bf commit 29ba8d3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/utxo-lib/test/bitgo/psbt/SignVerifyPsbtAndTx.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,18 @@ function runPsbt(
136136
});
137137

138138
it('matches fixture', async function () {
139+
let finalizedPsbt: UtxoPsbt | undefined;
139140
let extractedTransaction: Buffer | undefined;
140141
if (sign === 'fullsigned') {
141-
extractedTransaction = psbt.clone().finalizeAllInputs().extractTransaction().toBuffer();
142+
finalizedPsbt = psbt.clone().finalizeAllInputs();
143+
extractedTransaction = finalizedPsbt.extractTransaction().toBuffer();
142144
}
143145
const fixture = {
144146
walletKeys: rootWalletKeys.triple.map((xpub) => xpub.toBase58()),
145147
psbtBase64: psbt.toBase64(),
146148
inputs: psbt.txInputs.map((input) => toFixture(input)),
147149
psbtInputs: getFixturePsbtInputs(psbt, inputs),
150+
psbtInputsFinalized: finalizedPsbt ? getFixturePsbtInputs(finalizedPsbt, inputs) : null,
148151
outputs: psbt.txOutputs.map((output) => toFixture(output)),
149152
psbtOutputs: getFixturePsbtOutputs(psbt),
150153
extractedTransaction: extractedTransaction ? toFixture(extractedTransaction) : null,

0 commit comments

Comments
 (0)