Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] return a proper errors instead of debug asserts #1165

Merged
merged 8 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions signer/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,11 @@ pub enum Error {
#[error("invalid configuration")]
InvalidConfiguration,

/// We throw this error when MultisigTx was created incorrectly:
/// Txid of created MultisigTx is not equal to txid we expect
#[error("MultisigTx creation error: MultisigTx was created with txid {0}, but expected txid {1}")]
MultisigTxCreationError(blockstack_lib::burnchains::Txid, blockstack_lib::burnchains::Txid),

MCJOHN974 marked this conversation as resolved.
Show resolved Hide resolved
/// Observer dropped
#[error("observer dropped")]
ObserverDropped,
Expand Down
4 changes: 3 additions & 1 deletion signer/src/transaction_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,9 @@ where
let multi_sig = MultisigTx::new_tx(&request.contract_tx, &wallet, request.tx_fee);
let txid = multi_sig.tx().txid();

debug_assert_eq!(txid, request.txid);
if txid != request.txid {
return Err(Error::MultisigTxCreationError(txid, request.txid));
}

let signature = crate::signature::sign_stacks_tx(multi_sig.tx(), &self.signer_private_key);

Expand Down
Loading