scripted-diff: Replace GenTxidVariant with GenTxid

-BEGIN VERIFY SCRIPT-
sed -i 's/GenTxidVariant/GenTxid/g' $(git grep -l 'GenTxidVariant')
-END VERIFY SCRIPT-
This commit is contained in:
marcofleon
2025-07-01 22:06:01 +01:00
parent c8ba199598
commit a60f863d3e
14 changed files with 66 additions and 66 deletions

View File

@@ -228,8 +228,8 @@ FUZZ_TARGET(txdownloadman, .init = initialize)
},
[&] {
auto gtxid = fuzzed_data_provider.ConsumeBool() ?
GenTxidVariant{rand_tx->GetHash()} :
GenTxidVariant{rand_tx->GetWitnessHash()};
GenTxid{rand_tx->GetHash()} :
GenTxid{rand_tx->GetWitnessHash()};
txdownloadman.AddTxAnnouncement(rand_peer, gtxid, time);
},
[&] {
@@ -373,8 +373,8 @@ FUZZ_TARGET(txdownloadman_impl, .init = initialize)
},
[&] {
auto gtxid = fuzzed_data_provider.ConsumeBool() ?
GenTxidVariant{rand_tx->GetHash()} :
GenTxidVariant{rand_tx->GetWitnessHash()};
GenTxid{rand_tx->GetHash()} :
GenTxid{rand_tx->GetWitnessHash()};
txdownload_impl.AddTxAnnouncement(rand_peer, gtxid, time);
},
[&] {

View File

@@ -204,7 +204,7 @@ public:
}
// Call TxRequestTracker's implementation.
auto gtxid = is_wtxid ? GenTxidVariant{Wtxid::FromUint256(TXHASHES[txhash])} : GenTxidVariant{Txid::FromUint256(TXHASHES[txhash])};
auto gtxid = is_wtxid ? GenTxid{Wtxid::FromUint256(TXHASHES[txhash])} : GenTxid{Txid::FromUint256(TXHASHES[txhash])};
m_tracker.ReceivedInv(peer, gtxid, preferred, reqtime);
}
@@ -247,13 +247,13 @@ public:
//! list of (sequence number, txhash, is_wtxid) tuples.
std::vector<std::tuple<uint64_t, int, bool>> result;
std::vector<std::pair<NodeId, GenTxidVariant>> expected_expired;
std::vector<std::pair<NodeId, GenTxid>> expected_expired;
for (int txhash = 0; txhash < MAX_TXHASHES; ++txhash) {
// Mark any expired REQUESTED announcements as COMPLETED.
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) {
auto gtxid = ann2.m_is_wtxid ? GenTxidVariant{Wtxid::FromUint256(TXHASHES[txhash])} : GenTxidVariant{Txid::FromUint256(TXHASHES[txhash])};
auto gtxid = ann2.m_is_wtxid ? GenTxid{Wtxid::FromUint256(TXHASHES[txhash])} : GenTxid{Txid::FromUint256(TXHASHES[txhash])};
expected_expired.emplace_back(peer2, gtxid);
ann2.m_state = State::COMPLETED;
break;
@@ -272,7 +272,7 @@ public:
std::sort(expected_expired.begin(), expected_expired.end());
// Compare with TxRequestTracker's implementation.
std::vector<std::pair<NodeId, GenTxidVariant>> expired;
std::vector<std::pair<NodeId, GenTxid>> expired;
const auto actual = m_tracker.GetRequestable(peer, m_now, &expired);
std::sort(expired.begin(), expired.end());
assert(expired == expected_expired);