diff options
| author | MarcoFalke <[email protected]> | 2020-09-28 09:16:47 +0200 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2020-09-28 09:16:56 +0200 |
| commit | c95784e3d31dc557b175181bc034339df22cb5fd (patch) | |
| tree | 957b097c6396295735753e02693444de8fb90f51 /src/test | |
| parent | Merge #20026: test: typo in a functional test doc (diff) | |
| parent | wallet: no need for duplicate storage for ABANDON_HASH constant (diff) | |
| download | discoin-c95784e3d31dc557b175181bc034339df22cb5fd.tar.xz discoin-c95784e3d31dc557b175181bc034339df22cb5fd.zip | |
Merge #20016: uint256: 1 is a constant
4cc7171c9887e88027642927c979e507d7b78dda wallet: no need for duplicate storage for ABANDON_HASH constant (Anthony Towns)
82cf4641f4a161834d07ce83c18982d9b143c040 scripted-diff: Replace UINT256_ONE() with uint256::ONE (Anthony Towns)
183f308fff4caad3e3ada654b6fdf597d262c4c1 uint256: Update constructors to c++11, make ONE static (Anthony Towns)
Pull request description:
`UINT256_ONE()` returns a reference to a global; mark it as const to be sure someone doesn't accidently modify it.
ACKs for top commit:
promag:
ACK 4cc7171c9887e88027642927c979e507d7b78dda
MarcoFalke:
re ACK 4cc7171c98, only change is some constexpr shuffling 🛁
kallewoof:
ACK 4cc7171c9887e88027642927c979e507d7b78dda
Tree-SHA512: 7f399658bfd9ffa4075bc2349049476d842b9579a67518fb7151f56eab36907ef24b1474ee1e89bdc69fe181abe7295dfe19e33b3623d43cec71fc00e356e347
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/sighash_tests.cpp | 4 | ||||
| -rw-r--r-- | src/test/uint256_tests.cpp | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index c0bb92258..bc862de78 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -28,7 +28,7 @@ uint256 static SignatureHashOld(CScript scriptCode, const CTransaction& txTo, un { if (nIn >= txTo.vin.size()) { - return UINT256_ONE(); + return uint256::ONE; } CMutableTransaction txTmp(txTo); @@ -58,7 +58,7 @@ uint256 static SignatureHashOld(CScript scriptCode, const CTransaction& txTo, un unsigned int nOut = nIn; if (nOut >= txTmp.vout.size()) { - return UINT256_ONE(); + return uint256::ONE; } txTmp.vout.resize(nOut+1); for (unsigned int i = 0; i < nOut; i++) diff --git a/src/test/uint256_tests.cpp b/src/test/uint256_tests.cpp index c0ae2f8cf..ae626d461 100644 --- a/src/test/uint256_tests.cpp +++ b/src/test/uint256_tests.cpp @@ -278,4 +278,10 @@ BOOST_AUTO_TEST_CASE( operator_with_self ) BOOST_CHECK(v == UintToArith256(uint256S("0"))); } +BOOST_AUTO_TEST_CASE( check_ONE ) +{ + uint256 one = uint256S("0000000000000000000000000000000000000000000000000000000000000001"); + BOOST_CHECK_EQUAL(one, uint256::ONE); +} + BOOST_AUTO_TEST_SUITE_END() |