Skip to content

Commit fafe4b8

Browse files
author
MarcoFalke
committed
test: refactor: Replace SetHex with uint256 constructor directly
This avoids a hex-decoding and makes the next commit smaller.
1 parent 7cc00bf commit fafe4b8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/test/pow_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(CheckProofOfWork_test_negative_target)
8686
uint256 hash;
8787
unsigned int nBits;
8888
nBits = UintToArith256(consensus.powLimit).GetCompact(true);
89-
hash.SetHex("0x1");
89+
hash = uint256{1};
9090
BOOST_CHECK(!CheckProofOfWork(hash, nBits, consensus));
9191
}
9292

@@ -95,7 +95,7 @@ BOOST_AUTO_TEST_CASE(CheckProofOfWork_test_overflow_target)
9595
const auto consensus = CreateChainParams(*m_node.args, ChainType::MAIN)->GetConsensus();
9696
uint256 hash;
9797
unsigned int nBits{~0x00800000U};
98-
hash.SetHex("0x1");
98+
hash = uint256{1};
9999
BOOST_CHECK(!CheckProofOfWork(hash, nBits, consensus));
100100
}
101101

@@ -107,7 +107,7 @@ BOOST_AUTO_TEST_CASE(CheckProofOfWork_test_too_easy_target)
107107
arith_uint256 nBits_arith = UintToArith256(consensus.powLimit);
108108
nBits_arith *= 2;
109109
nBits = nBits_arith.GetCompact();
110-
hash.SetHex("0x1");
110+
hash = uint256{1};
111111
BOOST_CHECK(!CheckProofOfWork(hash, nBits, consensus));
112112
}
113113

0 commit comments

Comments
 (0)