mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 02:31:05 +02:00
util: make ParseMoney return a std::optional<CAmount>
This commit is contained in:
@ -188,10 +188,11 @@ static void RegisterLoad(const std::string& strInput)
|
||||
|
||||
static CAmount ExtractAndValidateValue(const std::string& strValue)
|
||||
{
|
||||
CAmount value;
|
||||
if (!ParseMoney(strValue, value))
|
||||
if (std::optional<CAmount> parsed = ParseMoney(strValue)) {
|
||||
return parsed.value();
|
||||
} else {
|
||||
throw std::runtime_error("invalid TX output value");
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
static void MutateTxVersion(CMutableTransaction& tx, const std::string& cmdVal)
|
||||
|
Reference in New Issue
Block a user