mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-19 16:18:46 +02:00
Contracts: validate net_change in the foreign sign path
The foreign contract_sign API unwrapped the optional net_change field, so an incomplete request could panic the wallet. Return an error instead, matching the foreign contract_new path. Addresses PR #754 review (foreign.rs).
This commit is contained in:
@@ -276,7 +276,9 @@ where
|
||||
C: NodeClient + 'a,
|
||||
K: Keychain + 'a,
|
||||
{
|
||||
let net_change = args.net_change.unwrap();
|
||||
let net_change = args.net_change.ok_or_else(|| {
|
||||
Error::GenericError("Contract requires a net change (--send or --receive)".to_string())
|
||||
})?;
|
||||
if net_change <= 0 {
|
||||
return Err(Error::GenericError(
|
||||
"Can't sign a non-receiving contract from a foreign API.".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user