This is de-facto no longer hidden
Add tests and documentation for blocksonly #15990
pull MarcoFalke wants to merge 4 commits into bitcoin:master from MarcoFalke:1905-docTestBlocksOnly changing 10 files +89 −9-
MarcoFalke commented at 2:35 PM on May 9, 2019: member
-
fa1dce7329
net: Rename ::fRelayTxes to ::g_relay_txes
This helps to distinguish it from CNode::fRelayTxes and avoid bugs like 425278d17bd0edf8a3a7cc81e55016f7fd8e7726
- MarcoFalke added this to the milestone 0.18.1 on May 9, 2019
- MarcoFalke force-pushed on May 9, 2019
- DrahtBot added the label Docs on May 9, 2019
- DrahtBot added the label P2P on May 9, 2019
- DrahtBot added the label RPC/REST/ZMQ on May 9, 2019
- DrahtBot added the label Tests on May 9, 2019
-
in doc/reduce-traffic.md:43 in fae9f795eb outdated
34 | @@ -35,3 +35,9 @@ blocks and transactions to fewer nodes. 35 | Reducing the maximum connected nodes to a minimum could be desirable if traffic 36 | limits are tiny. Keep in mind that bitcoin's trustless model works best if you are 37 | connected to a handful of nodes. 38 | + 39 | +## 4. Turn off transaction relay (`-blocksonly`) 40 | + 41 | +Forwarding transactions to peers increases the P2P traffic. To only sync blocks 42 | +with other peers, you can disable transaction relay. Be reminded that this 43 | +setting could hurt your privacy if used while a wallet is loaded.
promag commented at 5:22 PM on May 9, 2019:It could elaborate a bit on how it hurts privacy for those that aren't aware of the issue?
gmaxwell commented at 3:40 AM on May 10, 2019:We might want to also add that it greatly slows block propagation speed. (just so we don't get miners thinking this will optimize their nodes. :) )
in test/functional/p2p_blocksonly.py:47 in fae9f795eb outdated
42 | + assert_equal(self.nodes[0].getnetworkinfo()['localrelay'], False) 43 | + with self.nodes[0].assert_debug_log(['transaction sent in violation of protocol peer=0']): 44 | + self.nodes[0].p2p.send_message(msg_tx(FromHex(CTransaction(), sigtx))) 45 | + self.nodes[0].p2p.sync_with_ping() 46 | + 47 | + self.log.info('Check that txs from wallet (or rpc) are not rejected and relayed to other peers')
promag commented at 5:32 PM on May 9, 2019:Why mention wallet if this doesn't use it?
promag commented at 5:32 PM on May 9, 2019: memberutACK fae9f795eb1283d82761ffef7e7feffe2597cf59.
DrahtBot commented at 5:53 PM on May 9, 2019: member<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #15984 (net: Remove -whitelistrelay by MarcoFalke)
- #15759 ([p2p] Add 2 outbound blocks-only connections by sdaftuar)
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.
gmaxwell commented at 3:41 AM on May 10, 2019: contributorGreat work!
test: Format predicate source as multiline on error fa3872e7b4MarcoFalke force-pushed on May 10, 2019in doc/reduce-traffic.md:45 in fac23965b1 outdated
40 | + 41 | +Forwarding transactions to peers increases the P2P traffic. To only sync blocks 42 | +with other peers, you can disable transaction relay. 43 | + 44 | +Be reminded that this setting could hurt your privacy if used while a wallet is 45 | +loaded or you use the node to broadcast transactions.
jonatack commented at 10:30 AM on May 13, 2019:nit: or if you use
MarcoFalke commented at 1:20 PM on May 13, 2019:Thanks, done
in test/functional/p2p_blocksonly.py:15 in fac23965b1 outdated
10 | +from test_framework.util import assert_equal 11 | + 12 | + 13 | +class P2PBlocksOnly(BitcoinTestFramework): 14 | + def set_test_params(self): 15 | + self.setup_clean_chain = False
jonatack commented at 10:34 AM on May 13, 2019:Could be omitted, defaults to False in test_framework.py::L94
MarcoFalke commented at 1:20 PM on May 13, 2019:I like to redundantly set it
jonatack commented at 10:42 AM on May 13, 2019: memberACK fac23965b1130175a01a4b35d4108f1d7c42ac10. 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 -- -blocksonlyAfter:
$ 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)in src/init.cpp:386 in fac23965b1 outdated
382 | @@ -383,7 +383,7 @@ void SetupServerArgs() 383 | gArgs.AddArg("-blocksdir=<dir>", "Specify blocks directory (default: <datadir>/blocks)", false, OptionsCategory::OPTIONS); 384 | gArgs.AddArg("-blocknotify=<cmd>", "Execute command when the best block changes (%s in cmd is replaced by block hash)", false, OptionsCategory::OPTIONS); 385 | gArgs.AddArg("-blockreconstructionextratxn=<n>", strprintf("Extra transactions to keep in memory for compact block reconstructions (default: %u)", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN), false, OptionsCategory::OPTIONS); 386 | - gArgs.AddArg("-blocksonly", strprintf("Whether to operate in a blocks only mode (default: %u)", DEFAULT_BLOCKSONLY), true, OptionsCategory::OPTIONS); 387 | + gArgs.AddArg("-blocksonly", strprintf("Whether to reject transactions from network peers. Transactions from the wallet or RPC are not affected. (default: %u)", DEFAULT_BLOCKSONLY), false, OptionsCategory::OPTIONS);
jonatack commented at 10:47 AM on May 13, 2019:Displaying
(default: 0)in the help, is it clear enough that the default behavior is off/false?
jonatack commented at 10:48 AM on May 13, 2019:from a user experience point of view
MarcoFalke commented at 1:17 PM on May 13, 2019:We do that for all flags, IIRC
MarcoFalke force-pushed on May 13, 2019MarcoFalke commented at 1:23 PM on May 13, 2019: memberReplied to or addressed @jonatack s nits. Only doc-changes in the last force push
MarcoFalke commented at 1:24 PM on May 13, 2019: memberAlso addressed @promag s feedback
jamesob commented at 1:26 PM on May 13, 2019: memberConcept ACK - will review today.
in doc/reduce-traffic.md:39 in fa9c8295ea outdated
34 | @@ -35,3 +35,14 @@ blocks and transactions to fewer nodes. 35 | Reducing the maximum connected nodes to a minimum could be desirable if traffic 36 | limits are tiny. Keep in mind that bitcoin's trustless model works best if you are 37 | connected to a handful of nodes. 38 | + 39 | +## 4. Turn off transaction relay (`-blocksonly`)
jamesob commented at 1:27 PM on May 13, 2019:<3 great doc.
in doc/reduce-traffic.md:48 in fa9c8295ea outdated
43 | + 44 | +Be reminded that this setting could hurt your privacy if used while a wallet is 45 | +loaded or if you use the node to broadcast transactions. 46 | + 47 | +Moreover, this makes block propagation slower because compact block relay can 48 | +only be used when transaction relay is enabled
jnewbery commented at 1:36 PM on May 13, 2019:Suggest that you also document that using
-blocksonlystops fee estimation from working.nit: end sentence with a
..
MarcoFalke commented at 2:29 PM on May 13, 2019:Oof, good point!
in test/functional/p2p_blocksonly.py:45 in fa9a017651 outdated
40 | + }], 41 | + )['hex'] 42 | + assert_equal(self.nodes[0].getnetworkinfo()['localrelay'], False) 43 | + with self.nodes[0].assert_debug_log(['transaction sent in violation of protocol peer=0']): 44 | + self.nodes[0].p2p.send_message(msg_tx(FromHex(CTransaction(), sigtx))) 45 | + self.nodes[0].p2p.sync_with_ping()
jamesob commented at 1:37 PM on May 13, 2019: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 thissync_with_ping()?
MarcoFalke commented at 2:29 PM on May 13, 2019: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?
jamesob commented at 2:36 PM on May 13, 2019:Yep, the latter sounds good.
jnewbery commented at 1:40 PM on May 13, 2019: memberutACK fa9c8295ea6420fe6ea2ca2a0b828e05689c2d92. One suggested change to the docs.
MarcoFalke force-pushed on May 13, 2019test: Add test for p2p_blocksonly fa320de79fdoc: Mention blocksonly in reduce-traffic.md, unhide option fa8ced32a6MarcoFalke force-pushed on May 13, 2019jamesob commented at 2:58 PM on May 13, 2019: memberutACK https://github.com/bitcoin/bitcoin/commit/fa8ced32a60dea37ac169241cf9a1f708ef46c4b
Only changes since https://github.com/bitcoin/bitcoin/commit/979519e895ad277b60a25180b46e1847d021d9ed are adding a mempool assertion and a period to the docs. Nice PR!
laanwj commented at 5:05 PM on May 16, 2019: memberutACK fa8ced32a60dea37ac169241cf9a1f708ef46c4b, thanks for adding documentation!
laanwj merged this on May 16, 2019laanwj closed this on May 16, 2019laanwj referenced this in commit df7addc4c6 on May 16, 2019MarcoFalke deleted the branch on May 16, 2019MarcoFalke referenced this in commit 9c1a607a09 on May 16, 2019MarcoFalke referenced this in commit 8f215c7a27 on May 16, 2019MarcoFalke referenced this in commit 3460555f47 on May 16, 2019MarcoFalke referenced this in commit 890a92eba8 on May 16, 2019sidhujag referenced this in commit d3e5ffa64b on May 18, 2019laanwj added the label Needs backport on Jul 18, 2019laanwj removed the label Needs backport on Jul 18, 2019laanwj removed this from the milestone 0.18.1 on Jul 18, 2019HashUnlimited referenced this in commit 43efe36d60 on Aug 23, 2019HashUnlimited referenced this in commit f8d7b0e205 on Aug 23, 2019HashUnlimited referenced this in commit 4757de61b9 on Aug 23, 2019HashUnlimited referenced this in commit 268ab37676 on Aug 23, 2019Bushstar referenced this in commit 9d62706693 on Aug 24, 2019Bushstar referenced this in commit 78d78252e8 on Aug 24, 2019Bushstar referenced this in commit 51fef285b3 on Aug 24, 2019Bushstar referenced this in commit ec4269a802 on Aug 24, 2019deadalnix referenced this in commit d58b083bf5 on Jun 8, 2020zkbot referenced this in commit ba4eb241e7 on Mar 31, 2021PastaPastaPasta referenced this in commit 2202f1b7c1 on Jun 25, 2021PastaPastaPasta referenced this in commit f2530cd835 on Jul 20, 2021PastaPastaPasta referenced this in commit b832736bf0 on Jul 20, 2021PastaPastaPasta referenced this in commit 3cb8293ba5 on Jul 21, 2021gades referenced this in commit e6fea60209 on May 9, 2022DrahtBot locked this on Aug 16, 2022
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me