mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
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:
@@ -302,7 +302,7 @@ struct Peer {
|
||||
* non-wtxid-relay peers, wtxid for wtxid-relay peers). We use the
|
||||
* mempool to sort transactions in dependency order before relay, so
|
||||
* this does not have to be sorted. */
|
||||
std::set<GenTxidVariant> m_tx_inventory_to_send GUARDED_BY(m_tx_inventory_mutex);
|
||||
std::set<GenTxid> m_tx_inventory_to_send GUARDED_BY(m_tx_inventory_mutex);
|
||||
/** Whether the peer has requested us to send our complete mempool. Only
|
||||
* permitted if the peer has NetPermissionFlags::Mempool or we advertise
|
||||
* NODE_BLOOM. See BIP35. */
|
||||
@@ -856,7 +856,7 @@ private:
|
||||
std::shared_ptr<const CBlock> m_most_recent_block GUARDED_BY(m_most_recent_block_mutex);
|
||||
std::shared_ptr<const CBlockHeaderAndShortTxIDs> m_most_recent_compact_block GUARDED_BY(m_most_recent_block_mutex);
|
||||
uint256 m_most_recent_block_hash GUARDED_BY(m_most_recent_block_mutex);
|
||||
std::unique_ptr<const std::map<GenTxidVariant, CTransactionRef>> m_most_recent_block_txs GUARDED_BY(m_most_recent_block_mutex);
|
||||
std::unique_ptr<const std::map<GenTxid, CTransactionRef>> m_most_recent_block_txs GUARDED_BY(m_most_recent_block_mutex);
|
||||
|
||||
// Data about the low-work headers synchronization, aggregated from all peers' HeadersSyncStates.
|
||||
/** Mutex guarding the other m_headers_presync_* variables. */
|
||||
@@ -2027,7 +2027,7 @@ void PeerManagerImpl::NewPoWValidBlock(const CBlockIndex *pindex, const std::sha
|
||||
std::async(std::launch::deferred, [&] { return NetMsg::Make(NetMsgType::CMPCTBLOCK, *pcmpctblock); })};
|
||||
|
||||
{
|
||||
auto most_recent_block_txs = std::make_unique<std::map<GenTxidVariant, CTransactionRef>>();
|
||||
auto most_recent_block_txs = std::make_unique<std::map<GenTxid, CTransactionRef>>();
|
||||
for (const auto& tx : pblock->vtx) {
|
||||
most_recent_block_txs->emplace(tx->GetHash(), tx);
|
||||
most_recent_block_txs->emplace(tx->GetWitnessHash(), tx);
|
||||
@@ -2166,7 +2166,7 @@ void PeerManagerImpl::RelayTransaction(const Txid& txid, const Wtxid& wtxid)
|
||||
// in the announcement.
|
||||
if (tx_relay->m_next_inv_send_time == 0s) continue;
|
||||
|
||||
const auto gtxid{peer.m_wtxid_relay ? GenTxidVariant{wtxid} : GenTxidVariant{txid}};
|
||||
const auto gtxid{peer.m_wtxid_relay ? GenTxid{wtxid} : GenTxid{txid}};
|
||||
if (!tx_relay->m_tx_inventory_known_filter.contains(gtxid.ToUint256())) {
|
||||
tx_relay->m_tx_inventory_to_send.insert(gtxid);
|
||||
}
|
||||
@@ -4011,7 +4011,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
pfrom.fDisconnect = true;
|
||||
return;
|
||||
}
|
||||
const GenTxidVariant gtxid = ToGenTxid(inv);
|
||||
const GenTxid gtxid = ToGenTxid(inv);
|
||||
AddKnownTx(*peer, inv.hash);
|
||||
|
||||
if (!m_chainman.IsInitialBlockDownload()) {
|
||||
@@ -4942,7 +4942,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
if (msg_type == NetMsgType::NOTFOUND) {
|
||||
std::vector<CInv> vInv;
|
||||
vRecv >> vInv;
|
||||
std::vector<GenTxidVariant> tx_invs;
|
||||
std::vector<GenTxid> tx_invs;
|
||||
if (vInv.size() <= node::MAX_PEER_TX_ANNOUNCEMENTS + MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
|
||||
for (CInv &inv : vInv) {
|
||||
if (inv.IsGenTxMsg()) {
|
||||
@@ -5450,7 +5450,7 @@ class CompareInvMempoolOrder
|
||||
public:
|
||||
explicit CompareInvMempoolOrder(CTxMemPool* mempool) : m_mempool{mempool} {}
|
||||
|
||||
bool operator()(std::set<GenTxidVariant>::iterator a, std::set<GenTxidVariant>::iterator b)
|
||||
bool operator()(std::set<GenTxid>::iterator a, std::set<GenTxid>::iterator b)
|
||||
{
|
||||
/* As std::make_heap produces a max-heap, we want the entries with the
|
||||
* fewest ancestors/highest fee to sort later. */
|
||||
@@ -5793,9 +5793,9 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
|
||||
// Determine transactions to relay
|
||||
if (fSendTrickle) {
|
||||
// Produce a vector with all candidates for sending
|
||||
std::vector<std::set<GenTxidVariant>::iterator> vInvTx;
|
||||
std::vector<std::set<GenTxid>::iterator> vInvTx;
|
||||
vInvTx.reserve(tx_relay->m_tx_inventory_to_send.size());
|
||||
for (std::set<GenTxidVariant>::iterator it = tx_relay->m_tx_inventory_to_send.begin(); it != tx_relay->m_tx_inventory_to_send.end(); it++) {
|
||||
for (std::set<GenTxid>::iterator it = tx_relay->m_tx_inventory_to_send.begin(); it != tx_relay->m_tx_inventory_to_send.end(); it++) {
|
||||
vInvTx.push_back(it);
|
||||
}
|
||||
const CFeeRate filterrate{tx_relay->m_fee_filter_received.load()};
|
||||
@@ -5812,9 +5812,9 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
|
||||
while (!vInvTx.empty() && nRelayedTransactions < broadcast_max) {
|
||||
// Fetch the top element from the heap
|
||||
std::pop_heap(vInvTx.begin(), vInvTx.end(), compareInvMempoolOrder);
|
||||
std::set<GenTxidVariant>::iterator it = vInvTx.back();
|
||||
std::set<GenTxid>::iterator it = vInvTx.back();
|
||||
vInvTx.pop_back();
|
||||
GenTxidVariant hash = *it;
|
||||
GenTxid hash = *it;
|
||||
Assume(peer->m_wtxid_relay == hash.IsWtxid());
|
||||
CInv inv(peer->m_wtxid_relay ? MSG_WTX : MSG_TX, hash.ToUint256());
|
||||
// Remove it from the to-be-sent set
|
||||
@@ -5962,7 +5962,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
|
||||
//
|
||||
{
|
||||
LOCK(m_tx_download_mutex);
|
||||
for (const GenTxidVariant& gtxid : m_txdownloadman.GetRequestsToSend(pto->GetId(), current_time)) {
|
||||
for (const GenTxid& gtxid : m_txdownloadman.GetRequestsToSend(pto->GetId(), current_time)) {
|
||||
vGetData.emplace_back(gtxid.IsWtxid() ? MSG_WTX : (MSG_TX | GetFetchFlags(*peer)), gtxid.ToUint256());
|
||||
if (vGetData.size() >= MAX_GETDATA_SZ) {
|
||||
MakeAndPushMessage(*pto, NetMsgType::GETDATA, vGetData);
|
||||
|
||||
Reference in New Issue
Block a user