-
Notifications
You must be signed in to change notification settings - Fork 37.7k
[p2p] miscellaneous wtxid followups #19879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fanquake
merged 4 commits into
bitcoin:master
from
amitiuttarwar:2020-08-wtxid-unbroadcast-followups
Sep 15, 2020
Merged
[p2p] miscellaneous wtxid followups #19879
fanquake
merged 4 commits into
bitcoin:master
from
amitiuttarwar:2020-08-wtxid-unbroadcast-followups
Sep 15, 2020
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When I originally implemented the unbroadcast set in 18038, it just tracked txids. After 18038 was merged, I offered a patch to 18044 to make the unbroadcast changes compatible with wtxid relay. In this patch, I updated `unbroadcast_txids` to a map of txid -> wtxid. Post merge review comments shed light on the fact that this update was unnecessary, and distracting. So, this commit updates the unbroadcast ids back to a set.
The else clause is dead code because the only way to not enter the if branch is if TX_WITNESS_STRIPPED is true. In that case, it would not have a witness to match the `tx.HasWitness()` else condition. Co-authored-by: Adam Jonas <jonas@chaincode.com> Co-authored-by: John Newbery <john@johnnewbery.com>
Previously, `tx` was being read after having `std::move` called on it. The std::move operator indicates to the compiler that this object may be "moved from", so we shouldn't subsequently read from it. The current code is not problematic since tx is passed in as a const ref. But this `std::move` is at best misleading & at worst problematic, so remove it.
2 tasks
jnewbery
reviewed
Sep 5, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK a8a64ac |
utACK a8a64ac |
sdaftuar
approved these changes
Sep 15, 2020
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Sep 16, 2020
a8a64ac [BroadcastTransaction] Remove unsafe move operator (Amiti Uttarwar) 125c038 [p2p] Remove dead code (Amiti Uttarwar) fc66d0a [p2p] Check for nullptr before dereferencing pointer (Adam Jonas) cb79b9d [mempool] Revert unbroadcast set to tracking just txid (Amiti Uttarwar) Pull request description: Addresses some outstanding review comments from bitcoin#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](bitcoin#18044 (comment)) [2](bitcoin#18044 (comment)) [3](bitcoin#18044 (comment)) thanks to jnewbery & adamjonas for flagging these ! ! ACKs for top commit: sdaftuar: utACK a8a64ac naumenkogs: utACK a8a64ac jnewbery: utACK a8a64ac Tree-SHA512: 7be669cb30cc17fb9e06b50e636ef7887c6a27354697987e4e4d38dba4b8f50e175647587430cd9bc3295bec01ce8b1e6639a50a4249d8fff9b1ca1b9ead3277
Fabcien
pushed a commit
to Bitcoin-ABC/bitcoin-abc
that referenced
this pull request
Nov 16, 2021
Summary: Previously, `tx` was being read after having `std::move` called on it. The std::move operator indicates to the compiler that this object may be "moved from", so we shouldn't subsequently read from it. The current code is not problematic since tx is passed in as a const ref. But this `std::move` is at best misleading & at worst problematic, so remove it. This is a backport of [[bitcoin/bitcoin#19879 | core#19879]] bitcoin/bitcoin@a8a64ac The other commits of that pull request are not relevant, as they deal with segwit issues. This missing backport was noticed in the review of D10464, which adds a use of `tx` after move. Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10474
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses some outstanding review comments from #18044
Links to comments on wtxid PR: 1 2 3
thanks to jnewbery & adamjonas for flagging these ! !