Skip to content

Commit 49829c8

Browse files
OttoAllmendingerllm-git
andcommitted
feat(wasm-utxo): add test for half-signing unsigned PSBTs
Implement a helper function for testing that a user signature can be applied to an unsigned PSBT. Sets up the test framework but leaves the implementation as a todo for later. Issue: BTC-2652 Co-authored-by: llm-git <[email protected]>
1 parent b7581b3 commit 49829c8

File tree

1 file changed

+27
-0
lines changed
  • packages/wasm-utxo/src/bitgo_psbt

1 file changed

+27
-0
lines changed

packages/wasm-utxo/src/bitgo_psbt/mod.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,20 @@ mod tests {
385385
output.script_pubkey.to_hex_string()
386386
}
387387

388+
// ensure we can put the first signature (user signature) on an unsigned PSBT
389+
fn assert_half_sign(
390+
network: Network,
391+
tx_format: fixtures::TxFormat,
392+
unsigned_bitgo_psbt: &BitGoPsbt,
393+
wallet_keys: &RootWalletKeys,
394+
input_index: usize,
395+
input_fixture: &fixtures::PsbtInputFixture,
396+
halfsigned_fixture: &fixtures::PsbtInputFixture,
397+
) -> Result<(), String> {
398+
// todo!()
399+
Ok(())
400+
}
401+
388402
fn assert_full_signed_matches_wallet_scripts(
389403
network: Network,
390404
tx_format: fixtures::TxFormat,
@@ -513,6 +527,19 @@ mod tests {
513527

514528
let psbt_input_stages = psbt_input_stages.unwrap();
515529

530+
assert_half_sign(
531+
network,
532+
tx_format,
533+
&psbt_stages
534+
.unsigned
535+
.to_bitgo_psbt(network)
536+
.expect("Failed to convert to BitGo PSBT"),
537+
&psbt_input_stages.wallet_keys,
538+
psbt_input_stages.input_index,
539+
&psbt_input_stages.input_fixture_unsigned,
540+
&psbt_input_stages.input_fixture_halfsigned,
541+
)?;
542+
516543
assert_full_signed_matches_wallet_scripts(
517544
network,
518545
tx_format,

0 commit comments

Comments
 (0)