mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge bitcoin/bitcoin#23336: refactor: Make GenTxid boolean constructor private
fa4ec1c0bdMake GenTxid boolean constructor private (MarcoFalke)faeb9a5753remove unused CTxMemPool::info(const uint256& txid) (MarcoFalke) Pull request description: This boolean argument is either verbose (when used with a named arg) or unintuitive and dangerous (when used as a plain bool). Fix that by making the constructor private. ACKs for top commit: laanwj: Code review ACKfa4ec1c0bdjnewbery: Code review ACKfa4ec1c0bdglozow: code review ACKfa4ec1c0bdTree-SHA512: bf08ee09168885cfda71e5a01ec412b93964662a90dd9d91e75f7fdf2eaff7c21a95204d0e90b00438bfeab564d0aea66bdb9c0394ee7a05743e65a817159446
This commit is contained in:
@@ -204,7 +204,7 @@ public:
|
||||
}
|
||||
|
||||
// Call TxRequestTracker's implementation.
|
||||
m_tracker.ReceivedInv(peer, GenTxid{is_wtxid, TXHASHES[txhash]}, preferred, reqtime);
|
||||
m_tracker.ReceivedInv(peer, is_wtxid ? GenTxid::Wtxid(TXHASHES[txhash]) : GenTxid::Txid(TXHASHES[txhash]), preferred, reqtime);
|
||||
}
|
||||
|
||||
void RequestedTx(int peer, int txhash, std::chrono::microseconds exptime)
|
||||
@@ -252,7 +252,7 @@ public:
|
||||
for (int peer2 = 0; peer2 < MAX_PEERS; ++peer2) {
|
||||
Announcement& ann2 = m_announcements[txhash][peer2];
|
||||
if (ann2.m_state == State::REQUESTED && ann2.m_time <= m_now) {
|
||||
expected_expired.emplace_back(peer2, GenTxid{ann2.m_is_wtxid, TXHASHES[txhash]});
|
||||
expected_expired.emplace_back(peer2, ann2.m_is_wtxid ? GenTxid::Wtxid(TXHASHES[txhash]) : GenTxid::Txid(TXHASHES[txhash]));
|
||||
ann2.m_state = State::COMPLETED;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
/** Generate a random GenTxid; the txhash follows NewTxHash; the is_wtxid flag is random. */
|
||||
GenTxid NewGTxid(const std::vector<std::vector<NodeId>>& orders = {})
|
||||
{
|
||||
return {InsecureRandBool(), NewTxHash(orders)};
|
||||
return InsecureRandBool() ? GenTxid::Wtxid(NewTxHash(orders)) : GenTxid::Txid(NewTxHash(orders));
|
||||
}
|
||||
|
||||
/** Generate a new random NodeId to use as peer. The same NodeId is never returned twice
|
||||
@@ -494,8 +494,8 @@ void BuildWtxidTest(Scenario& scenario, int config)
|
||||
auto peerT = scenario.NewPeer();
|
||||
auto peerW = scenario.NewPeer();
|
||||
auto txhash = scenario.NewTxHash();
|
||||
GenTxid txid{false, txhash};
|
||||
GenTxid wtxid{true, txhash};
|
||||
auto txid{GenTxid::Txid(txhash)};
|
||||
auto wtxid{GenTxid::Wtxid(txhash)};
|
||||
|
||||
auto reqtimeT = InsecureRandBool() ? MIN_TIME : scenario.Now() + RandomTime8s();
|
||||
auto reqtimeW = InsecureRandBool() ? MIN_TIME : scenario.Now() + RandomTime8s();
|
||||
|
||||
Reference in New Issue
Block a user