mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Move {Get,Set}Compact from bignum to uint256
This commit is contained in:
parent
a7031507e6
commit
df9eb5e14f
13 changed files with 243 additions and 199 deletions
|
|
@ -466,7 +466,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
|
|||
bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey)
|
||||
{
|
||||
uint256 hash = pblock->GetHash();
|
||||
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
|
||||
uint256 hashTarget = uint256().SetCompact(pblock->nBits);
|
||||
|
||||
if (hash > hashTarget)
|
||||
return false;
|
||||
|
|
@ -552,7 +552,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||
// Search
|
||||
//
|
||||
int64_t nStart = GetTime();
|
||||
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
|
||||
uint256 hashTarget = uint256().SetCompact(pblock->nBits);
|
||||
uint256 hashbuf[2];
|
||||
uint256& hash = *alignup<16>(hashbuf);
|
||||
while (true)
|
||||
|
|
@ -636,7 +636,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||
{
|
||||
// Changing pblock->nTime can change work required on testnet:
|
||||
nBlockBits = ByteReverse(pblock->nBits);
|
||||
hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
|
||||
hashTarget.SetCompact(pblock->nBits);
|
||||
}
|
||||
}
|
||||
} }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue