mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Make XRPAmount constructor explicit:
Remove the implicit conversion from int64 to XRPAmount. The motivation for this was noticing that many calls to `to_string` with an integer parameter type were calling the wrong `to_string` function. Since the calls were not prefixed with `std::`, and there is no ADL to call `std::to_string`, this was converting the int to an `XRPAmount` and calling `to_string(XRPAmount)`. Since `to_string(XRPAmount)` did the same thing as `to_string(int)` this error went undetected.
This commit is contained in:
@@ -137,7 +137,7 @@ class Invariants_test : public beast::unit_test::suite
|
||||
if(! sle)
|
||||
return false;
|
||||
auto amt = sle->getFieldAmount (sfBalance);
|
||||
sle->setFieldAmount (sfBalance, amt + 500);
|
||||
sle->setFieldAmount (sfBalance, amt + STAmount{500});
|
||||
ac.view().update (sle);
|
||||
return true;
|
||||
});
|
||||
@@ -299,7 +299,7 @@ class Invariants_test : public beast::unit_test::suite
|
||||
auto const sle = ac.view().peek (keylet::account(A1.id()));
|
||||
if(! sle)
|
||||
return false;
|
||||
sle->setFieldAmount (sfBalance, {1, true});
|
||||
sle->setFieldAmount (sfBalance, STAmount{1, true});
|
||||
BEAST_EXPECT(sle->getFieldAmount(sfBalance).negative());
|
||||
ac.view().update (sle);
|
||||
return true;
|
||||
@@ -328,9 +328,10 @@ class Invariants_test : public beast::unit_test::suite
|
||||
[](Account const&, Account const&, ApplyContext&) { return true; },
|
||||
XRPAmount{INITIAL_XRP});
|
||||
|
||||
doInvariantCheck (enabled,
|
||||
{{ "fee paid is 20 exceeds fee specified in transaction." },
|
||||
{ "XRP net change of 0 doesn't match fee 20" }},
|
||||
doInvariantCheck(
|
||||
enabled,
|
||||
{{"fee paid is 20 exceeds fee specified in transaction."},
|
||||
{"XRP net change of 0 doesn't match fee 20"}},
|
||||
[](Account const&, Account const&, ApplyContext&) { return true; },
|
||||
XRPAmount{20},
|
||||
STTx { ttACCOUNT_SET,
|
||||
|
||||
Reference in New Issue
Block a user