-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Add tests and documentation for blocksonly #15990
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 helps to distinguish it from CNode::fRelayTxes and avoid bugs like 425278d
fae64e6
to
fae9f79
Compare
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 fae9f79.
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. |
Great work! |
fae9f79
to
fac2396
Compare
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.
ACK fac2396. Nice tests and docs. TIL blocksonly is no longer hidden.
Before:
$ bitcoind -help-debug | grep -A3 -- -blocksonly
-blocksonly
Whether to operate in a blocks only mode (default: 0)
$ bitcoind -help | grep -A3 -- -blocksonly
After:
$ bitcoind -help-debug | grep -A3 -- -blocksonly
-blocksonly
Whether to reject transactions from network peers. Transactions from the
wallet or RPC are not affected. (default: 0)
$ bitcoind -help | grep -A3 -- -blocksonly
-blocksonly
Whether to reject transactions from network peers. Transactions from the
wallet or RPC are not affected. (default: 0)
fac2396
to
fa9c829
Compare
Replied to or addressed @jonatack s nits. Only doc-changes in the last force push |
Also addressed @promag s feedback |
Concept ACK - will review today. |
@@ -35,3 +35,14 @@ blocks and transactions to fewer nodes. | |||
Reducing the maximum connected nodes to a minimum could be desirable if traffic | |||
limits are tiny. Keep in mind that bitcoin's trustless model works best if you are | |||
connected to a handful of nodes. | |||
|
|||
## 4. Turn off transaction relay (`-blocksonly`) |
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.
<3 great doc.
assert_equal(self.nodes[0].getnetworkinfo()['localrelay'], False) | ||
with self.nodes[0].assert_debug_log(['transaction sent in violation of protocol peer=0']): | ||
self.nodes[0].p2p.send_message(msg_tx(FromHex(CTransaction(), sigtx))) | ||
self.nodes[0].p2p.sync_with_ping() |
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.
Maybe I'm just being thick here, but shouldn't we assert that the mininode hasn't received a message containing the new tx from self.nodes[0]
after this sync_with_ping()
?
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.
You mean spinning up a second mininode to check that that one didn't receive it?
I think adding a getmempoolinfo()['size']==0 should do the same?
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.
Yep, the latter sounds good.
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 fa9c829. One suggested change to the docs.
fa9c829
to
979519e
Compare
979519e
to
fa8ced3
Compare
utACK fa8ced3, thanks for adding documentation! |
fa8ced3 doc: Mention blocksonly in reduce-traffic.md, unhide option (MarcoFalke) fa320de test: Add test for p2p_blocksonly (MarcoFalke) fa3872e test: Format predicate source as multiline on error (MarcoFalke) fa1dce7 net: Rename ::fRelayTxes to ::g_relay_txes (MarcoFalke) Pull request description: This is de-facto no longer hidden ACKs for commit fa8ced: jamesob: utACK fa8ced3 Tree-SHA512: 474fbdee6cbd035ed9068a066b6056c1f909ec7520be0417820fcd1672ab3069b53f55c5147968978d9258fd3a3933fe1a9ef8e4f6e14fb6ebbd79701a0a1245
This helps to distinguish it from CNode::fRelayTxes and avoid bugs like 425278d Github-Pull: bitcoin#15990 Rebased-From: fa1dce7
Github-Pull: bitcoin#15990 Rebased-From: fa3872e
Github-Pull: bitcoin#15990 Rebased-From: fa320de
Github-Pull: bitcoin#15990 Rebased-From: fa8ced3
fa8ced3 doc: Mention blocksonly in reduce-traffic.md, unhide option (MarcoFalke) fa320de test: Add test for p2p_blocksonly (MarcoFalke) fa3872e test: Format predicate source as multiline on error (MarcoFalke) fa1dce7 net: Rename ::fRelayTxes to ::g_relay_txes (MarcoFalke) Pull request description: This is de-facto no longer hidden ACKs for commit fa8ced: jamesob: utACK bitcoin@fa8ced3 Tree-SHA512: 474fbdee6cbd035ed9068a066b6056c1f909ec7520be0417820fcd1672ab3069b53f55c5147968978d9258fd3a3933fe1a9ef8e4f6e14fb6ebbd79701a0a1245
This helps to distinguish it from CNode::fRelayTxes and avoid bugs like 425278d Github-Pull: bitcoin#15990 Rebased-From: fa1dce7
Github-Pull: bitcoin#15990 Rebased-From: fa3872e
Github-Pull: bitcoin#15990 Rebased-From: fa320de
Github-Pull: bitcoin#15990 Rebased-From: fa8ced3
This helps to distinguish it from CNode::fRelayTxes and avoid bugs like 425278d Github-Pull: bitcoin#15990 Rebased-From: fa1dce7
Github-Pull: bitcoin#15990 Rebased-From: fa3872e
Github-Pull: bitcoin#15990 Rebased-From: fa320de
Github-Pull: bitcoin#15990 Rebased-From: fa8ced3
Summary: * net: Rename ::fRelayTxes to ::g_relay_txes This helps to distinguish it from CNode::fRelayTxes and avoid bugs like 425278d * test: Format predicate source as multiline on error * test: Add test for p2p_blocksonly * doc: Mention blocksonly in reduce-traffic.md, unhide option This is a backport of Core [[bitcoin/bitcoin#15990 | PR15990]] Test Plan: ninja all check-all Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D6424
Add -blocksonly option Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6993 - bitcoin/bitcoin#7046 - bitcoin/bitcoin#6780 - The third commit (we backported the rest in #2390). - bitcoin/bitcoin#7126 - bitcoin/bitcoin#7439 - bitcoin/bitcoin#15990 - Only the `-blocksonly` documentation changes. - bitcoin/bitcoin#16555 - bitcoin/bitcoin#18391 - Only the `-blocksonly` documentation changes. Part of #2074.
fa8ced3 doc: Mention blocksonly in reduce-traffic.md, unhide option (MarcoFalke) fa320de test: Add test for p2p_blocksonly (MarcoFalke) fa3872e test: Format predicate source as multiline on error (MarcoFalke) fa1dce7 net: Rename ::fRelayTxes to ::g_relay_txes (MarcoFalke) Pull request description: This is de-facto no longer hidden ACKs for commit fa8ced: jamesob: utACK bitcoin@fa8ced3 Tree-SHA512: 474fbdee6cbd035ed9068a066b6056c1f909ec7520be0417820fcd1672ab3069b53f55c5147968978d9258fd3a3933fe1a9ef8e4f6e14fb6ebbd79701a0a1245
fa8ced3 doc: Mention blocksonly in reduce-traffic.md, unhide option (MarcoFalke) fa320de test: Add test for p2p_blocksonly (MarcoFalke) fa3872e test: Format predicate source as multiline on error (MarcoFalke) fa1dce7 net: Rename ::fRelayTxes to ::g_relay_txes (MarcoFalke) Pull request description: This is de-facto no longer hidden ACKs for commit fa8ced: jamesob: utACK bitcoin@fa8ced3 Tree-SHA512: 474fbdee6cbd035ed9068a066b6056c1f909ec7520be0417820fcd1672ab3069b53f55c5147968978d9258fd3a3933fe1a9ef8e4f6e14fb6ebbd79701a0a1245
fa8ced3 doc: Mention blocksonly in reduce-traffic.md, unhide option (MarcoFalke) fa320de test: Add test for p2p_blocksonly (MarcoFalke) fa3872e test: Format predicate source as multiline on error (MarcoFalke) fa1dce7 net: Rename ::fRelayTxes to ::g_relay_txes (MarcoFalke) Pull request description: This is de-facto no longer hidden ACKs for commit fa8ced: jamesob: utACK bitcoin@fa8ced3 Tree-SHA512: 474fbdee6cbd035ed9068a066b6056c1f909ec7520be0417820fcd1672ab3069b53f55c5147968978d9258fd3a3933fe1a9ef8e4f6e14fb6ebbd79701a0a1245
fa8ced3 doc: Mention blocksonly in reduce-traffic.md, unhide option (MarcoFalke) fa320de test: Add test for p2p_blocksonly (MarcoFalke) fa3872e test: Format predicate source as multiline on error (MarcoFalke) fa1dce7 net: Rename ::fRelayTxes to ::g_relay_txes (MarcoFalke) Pull request description: This is de-facto no longer hidden ACKs for commit fa8ced: jamesob: utACK bitcoin@fa8ced3 Tree-SHA512: 474fbdee6cbd035ed9068a066b6056c1f909ec7520be0417820fcd1672ab3069b53f55c5147968978d9258fd3a3933fe1a9ef8e4f6e14fb6ebbd79701a0a1245
fa8ced3 doc: Mention blocksonly in reduce-traffic.md, unhide option (MarcoFalke) fa320de test: Add test for p2p_blocksonly (MarcoFalke) fa3872e test: Format predicate source as multiline on error (MarcoFalke) fa1dce7 net: Rename ::fRelayTxes to ::g_relay_txes (MarcoFalke) Pull request description: This is de-facto no longer hidden ACKs for commit fa8ced: jamesob: utACK bitcoin@fa8ced3 Tree-SHA512: 474fbdee6cbd035ed9068a066b6056c1f909ec7520be0417820fcd1672ab3069b53f55c5147968978d9258fd3a3933fe1a9ef8e4f6e14fb6ebbd79701a0a1245
This is de-facto no longer hidden