mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-11-30 02:43:56 +01:00
validate contract participant count
This commit is contained in:
@@ -79,17 +79,7 @@ where
|
||||
K: Keychain,
|
||||
{
|
||||
debug!("Creating a new contract context");
|
||||
// Validate num_participants before any fee math (kernel cost is divided by it, so 0
|
||||
// would be a divide-by-zero). This is the common setup path for every party (the
|
||||
// signer's value comes from the slate), so it also guards against a tampered slate.
|
||||
// Only 1 (self-spend) and 2 (standard) are implemented today; lift this when
|
||||
// multi-party contracts are supported.
|
||||
if setup_args.num_participants < 1 || setup_args.num_participants > 2 {
|
||||
return Err(Error::GenericError(format!(
|
||||
"Unsupported num_participants: {} (expected 1 or 2)",
|
||||
setup_args.num_participants
|
||||
)));
|
||||
}
|
||||
contract_utils::verify_num_participants(setup_args.num_participants)?;
|
||||
// sender should always refresh outputs
|
||||
updater::refresh_outputs(w, keychain_mask, parent_key_id, false)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user