Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/draft/multisig-order-independenc…
Browse files Browse the repository at this point in the history
…e' into draft/multisig-order-independence
  • Loading branch information
fess-v committed Apr 10, 2024
2 parents 72507cc + 2f06d95 commit a91581d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
31 changes: 13 additions & 18 deletions stackslib/src/chainstate/stacks/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,27 +373,21 @@ impl StacksMessageCodec for OrderIndependentMultisigSpendingCondition {
}

// must be given the right number of signatures
if num_sigs_given != signatures_required {
test_debug!(
"Failed to deserialize order independent multisig spending condition: got {} sigs, expected {}",
num_sigs_given,
signatures_required
if num_sigs_given < signatures_required {
let msg = format!(
"Failed to deserialize order independent multisig spending condition: got {num_sigs_given} sigs, expected at least {signatures_required}"
);
return Err(codec_error::DeserializeError(format!(
"Failed to parse order independent multisig spending condition: got {} sigs, expected {}",
num_sigs_given, signatures_required
)));
test_debug!("{msg}");
return Err(codec_error::DeserializeError(msg));
}

// must all be compressed if we're using P2WSH
if have_uncompressed && hash_mode == OrderIndependentMultisigHashMode::P2WSH {
test_debug!(
let msg = format!(
"Failed to deserialize order independent multisig spending condition: expected compressed keys only"
);
return Err(codec_error::DeserializeError(
"Failed to parse order independent multisig spending condition: expected compressed keys only"
.to_string(),
));
test_debug!("{msg}");
return Err(codec_error::DeserializeError(msg));
}

Ok(OrderIndependentMultisigSpendingCondition {
Expand Down Expand Up @@ -481,10 +475,11 @@ impl OrderIndependentMultisigSpendingCondition {
pubkeys.push(pubkey);
}

if num_sigs != self.signatures_required {
return Err(net_error::VerifyingError(
"Incorrect number of signatures".to_string(),
));
if num_sigs < self.signatures_required {
return Err(net_error::VerifyingError(format!(
"Not enough signatures. Got {num_sigs}, expected at least {req}",
req = self.signatures_required
)));
}

if have_uncompressed && self.hash_mode == OrderIndependentMultisigHashMode::P2WSH {
Expand Down
1 change: 0 additions & 1 deletion stackslib/src/net/api/getblock_v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use serde::de::Error as de_Error;
use stacks_common::codec::{StacksMessageCodec, MAX_MESSAGE_LEN};
use stacks_common::types::chainstate::{ConsensusHash, StacksBlockId};
use stacks_common::types::net::PeerHost;
use stacks_common::types::StacksEpochId;
use stacks_common::util::hash::to_hex;
use {serde, serde_json};

Expand Down

0 comments on commit a91581d

Please sign in to comment.