Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F12945004
D1709.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
D1709.diff
View Options
diff --git a/src/test/mempool_tests.cpp b/src/test/mempool_tests.cpp
--- a/src/test/mempool_tests.cpp
+++ b/src/test/mempool_tests.cpp
@@ -176,7 +176,7 @@
tx3.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx3.vout[0].nValue = 5 * COIN;
pool.addUnchecked(tx3.GetId(),
- entry.Fee(Amount(0LL)).Priority(100.0).FromTx(tx3));
+ entry.Fee(Amount::zero()).Priority(100.0).FromTx(tx3));
/* 2nd highest fee */
CMutableTransaction tx4 = CMutableTransaction();
@@ -211,7 +211,7 @@
tx6.vout.resize(1);
tx6.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx6.vout[0].nValue = 20 * COIN;
- pool.addUnchecked(tx6.GetId(), entry.Fee(Amount(0LL)).FromTx(tx6));
+ pool.addUnchecked(tx6.GetId(), entry.Fee(Amount::zero()).FromTx(tx6));
BOOST_CHECK_EQUAL(pool.size(), 6UL);
// Check that at this point, tx6 is sorted low
sortedOrder.insert(sortedOrder.begin(), tx6.GetId().ToString());
@@ -256,7 +256,8 @@
tx8.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx8.vout[0].nValue = 10 * COIN;
setAncestors.insert(pool.mapTx.find(tx7.GetId()));
- pool.addUnchecked(tx8.GetId(), entry.Fee(Amount(0LL)).Time(2).FromTx(tx8),
+ pool.addUnchecked(tx8.GetId(),
+ entry.Fee(Amount::zero()).Time(2).FromTx(tx8),
setAncestors);
// Now tx8 should be sorted low, but tx6/tx both high
@@ -271,7 +272,8 @@
tx9.vout.resize(1);
tx9.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx9.vout[0].nValue = 1 * COIN;
- pool.addUnchecked(tx9.GetId(), entry.Fee(Amount(0LL)).Time(3).FromTx(tx9),
+ pool.addUnchecked(tx9.GetId(),
+ entry.Fee(Amount::zero()).Time(3).FromTx(tx9),
setAncestors);
// tx9 should be sorted low
@@ -394,7 +396,7 @@
tx3.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx3.vout[0].nValue = 5 * COIN;
pool.addUnchecked(tx3.GetId(),
- entry.Fee(Amount(0LL)).Priority(100.0).FromTx(tx3));
+ entry.Fee(Amount::zero()).Priority(100.0).FromTx(tx3));
/* 2nd highest fee */
CMutableTransaction tx4 = CMutableTransaction();
@@ -439,7 +441,7 @@
tx6.vout[0].nValue = 20 * COIN;
uint64_t tx6Size = CTransaction(tx6).GetTotalSize();
- pool.addUnchecked(tx6.GetId(), entry.Fee(Amount(0LL)).FromTx(tx6));
+ pool.addUnchecked(tx6.GetId(), entry.Fee(Amount::zero()).FromTx(tx6));
BOOST_CHECK_EQUAL(pool.size(), 6UL);
// Ties are broken by hash
if (tx3.GetId() < tx6.GetId()) {
diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp
--- a/src/test/rpc_tests.cpp
+++ b/src/test/rpc_tests.cpp
@@ -242,8 +242,8 @@
}
BOOST_AUTO_TEST_CASE(rpc_format_monetary_values) {
- BOOST_CHECK(ValueFromAmount(Amount(0LL)).write() == "0.00000000");
- BOOST_CHECK(ValueFromAmount(Amount(1LL)).write() == "0.00000001");
+ BOOST_CHECK(ValueFromAmount(Amount::zero()).write() == "0.00000000");
+ BOOST_CHECK(ValueFromAmount(SATOSHI).write() == "0.00000001");
BOOST_CHECK(ValueFromAmount(Amount(17622195LL)).write() == "0.17622195");
BOOST_CHECK(ValueFromAmount(Amount(50000000LL)).write() == "0.50000000");
BOOST_CHECK(ValueFromAmount(Amount(89898989LL)).write() == "0.89898989");
@@ -291,11 +291,10 @@
BOOST_AUTO_TEST_CASE(rpc_parse_monetary_values) {
BOOST_CHECK_THROW(AmountFromValue(ValueFromString("-0.00000001")),
UniValue);
- BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0")), Amount(0LL));
+ BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0")), Amount::zero());
BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.00000000")),
- Amount(0LL));
- BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.00000001")),
- Amount(1LL));
+ Amount::zero());
+ BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.00000001")), SATOSHI);
BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.17622195")),
Amount(17622195LL));
BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.5")),
@@ -340,7 +339,7 @@
UniValue);
// should pass, cut trailing 0
BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.00000001000000")),
- Amount(1LL));
+ SATOSHI);
// should fail
BOOST_CHECK_THROW(AmountFromValue(ValueFromString("19e-9")), UniValue);
// should pass, leading 0 is present
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 6, 17:00 (20 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5082740
Default Alt Text
D1709.diff (4 KB)
Attached To
D1709: Amount(0LL) => Amount::zero() and Amount(1LL) => SATOSHI
Event Timeline
Log In to Comment