File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1226,7 +1226,6 @@ BOOST_AUTO_TEST_CASE(util_ParseMoney)
1226
1226
1227
1227
BOOST_CHECK_EQUAL (ParseMoney (" 12345.6789" ).value (), (COIN/10000 )*123456789 );
1228
1228
1229
- BOOST_CHECK_EQUAL (ParseMoney (" 100000000.00" ).value (), COIN*100000000 );
1230
1229
BOOST_CHECK_EQUAL (ParseMoney (" 10000000.00" ).value (), COIN*10000000 );
1231
1230
BOOST_CHECK_EQUAL (ParseMoney (" 1000000.00" ).value (), COIN*1000000 );
1232
1231
BOOST_CHECK_EQUAL (ParseMoney (" 100000.00" ).value (), COIN*100000 );
@@ -1252,6 +1251,7 @@ BOOST_AUTO_TEST_CASE(util_ParseMoney)
1252
1251
BOOST_CHECK_EQUAL (ParseMoney (" 0.00000001" ).value (), COIN/100000000 );
1253
1252
1254
1253
// Parsing amount that can not be represented should fail
1254
+ BOOST_CHECK (!ParseMoney (" 100000000.00" ));
1255
1255
BOOST_CHECK (!ParseMoney (" 0.000000001" ));
1256
1256
1257
1257
// Parsing empty string should fail
Original file line number Diff line number Diff line change @@ -81,5 +81,9 @@ std::optional<CAmount> ParseMoney(const std::string& money_string)
81
81
82
82
CAmount value = nWhole * COIN + nUnits;
83
83
84
+ if (!MoneyRange (value)) {
85
+ return std::nullopt;
86
+ }
87
+
84
88
return value;
85
89
}
You can’t perform that action at this time.
0 commit comments