-
Notifications
You must be signed in to change notification settings - Fork 37.7k
multiprocess: Add interfaces::Node::broadCastTransaction method #23499
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
Conversation
This fixes a null pointer crash in the bitcoin-gui PSBT dialog. The bitcoin-gui interfaces::Node object has a null NodeContext pointer, and can't broadcast transactions directly. It needs to broadcast transactions through the bitcoin-node process instead.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
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.
Code Review ACK 0e0f4fd
Seems dangerous to call a test-only method |
I don't really consider it a test-only method. The method is only currently used from tests, but it's not returning a fake context, and I think it could be legitimately be called outside of tests. For example, the current code calling this method works because the method returns the real working context pointer. The problem just happens after #10102, because the code calling it is not checking for null, and #10102 makes the method start to return null if the node is out-of-process. The method could be legitimately used in other cases to enable or disable features depending on whether the node is in-process, or change GUI behavior to deal with latency or overhead. I guess I'd prefer not to rename the method, but would reconsider it or move it to a friend class if it causes more problems. This is actually the first time I've seen the method misused any time, and it has been around a little while. |
In that case the "Useful for testing" docstring can be removed? Any function is "Useful for testing" if it is called by the tests. |
…nsaction method 0e0f4fd multiprocess: Add interfaces::Node::broadCastTransaction method (Russell Yanofsky) Pull request description: This fixes a null pointer crash in the bitcoin-gui PSBT dialog. The bitcoin-gui interfaces::Node object has a null NodeContext pointer, and can't broadcast transactions directly. It needs to broadcast transactions through the bitcoin-node process instead. --- This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10). ACKs for top commit: lsilva01: Code Review ACK 0e0f4fd Tree-SHA512: cd2c1fe8dc15e7cecf01a21d64319d6add1124995305a9ef9cb72f8492dc692c62d4f846182567d47a5048a533178a925419250941a47cb39932467c36bea3e1
I guess I would replace "Useful for testing" with "Mostly useful for testing" because like you say any function can be useful for testing. But the point of these short method descriptions is to help narrow down what methods you may want to call when you are writing code, and "mostly useful for testing" should be a good hint that calling this is useful when you are writing test code and need to access state, and a hint that this is probably not what you need otherwise. If the documentation is a problem, it could explicitly go on to say that the method can return null and callers should check for nulls. But this won't return null after #10102, and if there is actually another problem here I would look into a more solid protection like moving the method it to a friend class than trying to do something with documentation. |
This fixes a null pointer crash in the bitcoin-gui PSBT dialog. The bitcoin-gui interfaces::Node object has a null NodeContext pointer, and can't broadcast transactions directly. It needs to broadcast transactions through the bitcoin-node process instead.
This PR is part of the process separation project.