aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-tx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bitcoin-tx.cpp')
-rw-r--r--src/bitcoin-tx.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
index 3fc87ae1ff..cd2cdf01f2 100644
--- a/src/bitcoin-tx.cpp
+++ b/src/bitcoin-tx.cpp
@@ -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)