mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
random: get rid of GetRand by inlining
This commit is contained in:
parent
e2d1f84858
commit
ddc184d999
14 changed files with 40 additions and 49 deletions
|
|
@ -2124,7 +2124,7 @@ void PeerManagerImpl::BlockDisconnected(const std::shared_ptr<const CBlock> &blo
|
|||
*/
|
||||
void PeerManagerImpl::NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& pblock)
|
||||
{
|
||||
auto pcmpctblock = std::make_shared<const CBlockHeaderAndShortTxIDs>(*pblock, GetRand<uint64_t>());
|
||||
auto pcmpctblock = std::make_shared<const CBlockHeaderAndShortTxIDs>(*pblock, FastRandomContext().rand64());
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
|
|
@ -2522,7 +2522,7 @@ void PeerManagerImpl::ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv&
|
|||
if (a_recent_compact_block && a_recent_compact_block->header.GetHash() == pindex->GetBlockHash()) {
|
||||
MakeAndPushMessage(pfrom, NetMsgType::CMPCTBLOCK, *a_recent_compact_block);
|
||||
} else {
|
||||
CBlockHeaderAndShortTxIDs cmpctblock{*pblock, GetRand<uint64_t>()};
|
||||
CBlockHeaderAndShortTxIDs cmpctblock{*pblock, FastRandomContext().rand64()};
|
||||
MakeAndPushMessage(pfrom, NetMsgType::CMPCTBLOCK, cmpctblock);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -5617,7 +5617,7 @@ void PeerManagerImpl::MaybeSendPing(CNode& node_to, Peer& peer, std::chrono::mic
|
|||
if (pingSend) {
|
||||
uint64_t nonce;
|
||||
do {
|
||||
nonce = GetRand<uint64_t>();
|
||||
nonce = FastRandomContext().rand64();
|
||||
} while (nonce == 0);
|
||||
peer.m_ping_queued = false;
|
||||
peer.m_ping_start = now;
|
||||
|
|
@ -5984,7 +5984,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
|
|||
CBlock block;
|
||||
const bool ret{m_chainman.m_blockman.ReadBlockFromDisk(block, *pBestIndex)};
|
||||
assert(ret);
|
||||
CBlockHeaderAndShortTxIDs cmpctblock{block, GetRand<uint64_t>()};
|
||||
CBlockHeaderAndShortTxIDs cmpctblock{block, m_rng.rand64()};
|
||||
MakeAndPushMessage(*pto, NetMsgType::CMPCTBLOCK, cmpctblock);
|
||||
}
|
||||
state.pindexBestHeaderSent = pBestIndex;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue