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

fix wrong behavior: submit multisig txn only there are enough signatures #3482

Merged
merged 7 commits into from
Jun 25, 2022
14 changes: 11 additions & 3 deletions cmd/starcoin/src/cli_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl CliState {
AccountPublicKey::Multi(m) => m.clone(),
};

let _ = self.sign_multisig_txn_to_file_or_submit(
let multisig_txn_path = self.sign_multisig_txn_to_file_or_submit(
sender.address,
multisig_public_key,
None,
Expand All @@ -314,6 +314,11 @@ impl CliState {
blocking,
);

eprintln!(
"multisig-txn: {}",
multisig_txn_path.unwrap().as_path().to_str().unwrap()
templexxx marked this conversation as resolved.
Show resolved Hide resolved
);

Ok(execute_result)
}

Expand Down Expand Up @@ -365,7 +370,10 @@ impl CliState {
merged_signatures.threshold(),
merged_signatures.signatures().len()
);
if !merged_signatures.is_enough() {

let signatures_is_enough = merged_signatures.is_enough();

if !signatures_is_enough {
eprintln!(
"still require {} signatures",
merged_signatures.threshold() as usize - merged_signatures.signatures().len()
Expand All @@ -383,7 +391,7 @@ impl CliState {
SignedUserTransaction::new(partial_signed_txn.into_raw_transaction(), authenticator)
};

if submit {
if submit && signatures_is_enough {
let _ = self.submit_txn(signed_txn, blocking);
return Ok(PathBuf::new());
}
Expand Down