mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-25 06:55:32 +01:00
Merge #19879: [p2p] miscellaneous wtxid followups
a8a64acaf3[BroadcastTransaction] Remove unsafe move operator (Amiti Uttarwar)125c038126[p2p] Remove dead code (Amiti Uttarwar)fc66d0a65c[p2p] Check for nullptr before dereferencing pointer (Adam Jonas)cb79b9dbf4[mempool] Revert unbroadcast set to tracking just txid (Amiti Uttarwar) Pull request description: Addresses some outstanding review comments from #18044 - reverts unbroadcast txids to a set instead of a map (simpler, communicates intent better, takes less space, no efficiency advantages of map) - adds safety around two touchpoints (check for nullptr before dereferencing pointer, remove an inaccurate std::move operator) - removes some dead code Links to comments on wtxid PR: [1](https://github.com/bitcoin/bitcoin/pull/18044#discussion_r460495254) [2](https://github.com/bitcoin/bitcoin/pull/18044#discussion_r460496023) [3](https://github.com/bitcoin/bitcoin/pull/18044#discussion_r463532611) thanks to jnewbery & adamjonas for flagging these ! ! ACKs for top commit: sdaftuar: utACKa8a64acaf3naumenkogs: utACKa8a64acaf3jnewbery: utACKa8a64acaf3Tree-SHA512: 7be669cb30cc17fb9e06b50e636ef7887c6a27354697987e4e4d38dba4b8f50e175647587430cd9bc3295bec01ce8b1e6639a50a4249d8fff9b1ca1b9ead3277
This commit is contained in:
@@ -38,8 +38,8 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t
|
||||
if (!node.mempool->exists(hashTx)) {
|
||||
// Transaction is not already in the mempool. Submit it.
|
||||
TxValidationState state;
|
||||
if (!AcceptToMemoryPool(*node.mempool, state, std::move(tx),
|
||||
nullptr /* plTxnReplaced */, false /* bypass_limits */, max_tx_fee)) {
|
||||
if (!AcceptToMemoryPool(*node.mempool, state, tx,
|
||||
nullptr /* plTxnReplaced */, false /* bypass_limits */, max_tx_fee)) {
|
||||
err_string = state.ToString();
|
||||
if (state.IsInvalid()) {
|
||||
if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS) {
|
||||
@@ -80,7 +80,7 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t
|
||||
if (relay) {
|
||||
// the mempool tracks locally submitted transactions to make a
|
||||
// best-effort of initial broadcast
|
||||
node.mempool->AddUnbroadcastTx(hashTx, tx->GetWitnessHash());
|
||||
node.mempool->AddUnbroadcastTx(hashTx);
|
||||
|
||||
LOCK(cs_main);
|
||||
RelayTransaction(hashTx, tx->GetWitnessHash(), *node.connman);
|
||||
|
||||
Reference in New Issue
Block a user