Skip to content

Commit

Permalink
pr comments utxo
Browse files Browse the repository at this point in the history
  • Loading branch information
cylewitruk committed Feb 5, 2025
1 parent 7e621d7 commit 4642e66
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions signer/src/bitcoin/utxo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ impl UnsignedMockTransaction {
/// construct a [`Transaction`] with a single input and output.
pub fn new(signer_public_key: XOnlyPublicKey) -> Self {
let utxo = SignerUtxo {
outpoint: OutPoint::new(Txid::all_zeros(), 0),
outpoint: OutPoint::null(),
amount: Self::AMOUNT,
public_key: signer_public_key,
};
Expand All @@ -839,7 +839,7 @@ impl UnsignedMockTransaction {
input: vec![utxo.as_tx_input(&DUMMY_SIGNATURE)],
output: vec![TxOut {
value: Amount::from_sat(Self::AMOUNT),
script_pubkey: ScriptBuf::new_op_return([0x01, 0x02, 0x03]),
script_pubkey: ScriptBuf::new_op_return([]),
}],
};

Expand Down Expand Up @@ -1782,13 +1782,13 @@ mod tests {
// Sign the taproot sighash.
let message = secp256k1::Message::from_digest_slice(tapsig.as_byte_array())
.expect("Failed to create message");

// [1] Verify the correct signature, which should succeed.
let schnorr_sig = secp.sign_schnorr(&message, &tweaked.to_inner());
let taproot_sig = bitcoin::taproot::Signature {
signature: schnorr_sig,
sighash_type: TapSighashType::All,
};

// [1] Verify the correct signature, which should succeed.
unsigned
.verify_signature(&taproot_sig)
.expect("signature verification failed");
Expand Down Expand Up @@ -1827,6 +1827,17 @@ mod tests {
unsigned
.verify_signature(&taproot_sig)
.expect_err("signature verification should have failed");

// [5] Same as [4], but using its tweaked key.
let tweaked = keypair.tap_tweak(&secp, None);
let schnorr_sig = secp.sign_schnorr(&message, &tweaked.to_inner());
let taproot_sig = bitcoin::taproot::Signature {
signature: schnorr_sig,
sighash_type: TapSighashType::All,
};
unsigned
.verify_signature(&taproot_sig)
.expect_err("signature verification should have failed");
}

#[ignore = "For generating the SOLO_(DEPOSIT|WITHDRAWAL)_SIZE constants"]
Expand Down

0 comments on commit 4642e66

Please sign in to comment.