Add -blocksonly option #6993

pull pstratem wants to merge 8 commits into bitcoin:master from pstratem:blocksonly changing 5 files +21 −4
  1. pstratem commented at 2:26 am on November 12, 2015: contributor
    Set fRelay=false and reject all transactions into the mempool
  2. dcousens commented at 3:06 am on November 12, 2015: contributor
    Concept ACK
  3. luke-jr commented at 4:12 am on November 12, 2015: member
    Should this force wallet off? But I suppose maybe watch-only wallets don’t need to submit txns…
  4. gmaxwell commented at 4:28 am on November 12, 2015: contributor

    @luke-jr Nah! And, in fact with this set you can still submit txns (though it’ll be even more obvious its yours!)

    Concept Ack. Will test.

  5. luke-jr commented at 4:33 am on November 12, 2015: member
    As the code is right now, I don’t think you can submit txns…
  6. gmaxwell commented at 4:34 am on November 12, 2015: contributor
    @luke-jr Yup see my comment. :)
  7. pstratem commented at 4:35 am on November 12, 2015: contributor
    @gmaxwell and ruin my record for smallest patch to add a new feature? :)
  8. gmaxwell commented at 5:46 am on November 12, 2015: contributor
    Perhaps there is a reason it was record setting? :P
  9. gmaxwell commented at 5:53 am on November 12, 2015: contributor
    If, instead of blocking at the mempool it did not getdata, then local transactions would work, and you just need to disable the getdata inhibition for whitebinded peers, and the peer is local– so you’d keep your same lines of code count. Happy?
  10. paveljanik commented at 6:23 am on November 12, 2015: contributor
    The option should be documented, so yet another line is needed :-)
  11. paveljanik commented at 6:27 am on November 12, 2015: contributor
    What will we do to remote peers relaying transactions to us ignoring we announced that we do not want transactions in version message?
  12. laanwj added the label P2P on Nov 12, 2015
  13. laanwj commented at 6:45 am on November 12, 2015: member

    Concept ACK.

    Should this force wallet off? But I suppose maybe watch-only wallets don’t need to submit txns…

    Otherwise there’s already -walletbroadcast=0. To run a wallet without broadcasting.

  14. jonasschnelli commented at 7:42 am on November 12, 2015: contributor
    Concept ACK. Agree with @paveljanik: needs a help message line and maybe a comment on src/net.cpp:L454.
  15. MarcoFalke commented at 9:11 am on November 12, 2015: member

    Otherwise there’s already -walletbroadcast=0

    Use parameter interaction and set -walletbroadcast=0 with -blocksonly?

  16. laanwj commented at 10:28 am on November 12, 2015: member

    @MarcoFalke Yes.

    There was another similar issue raised on IRC: transactions from whitelisted peers. Even though nothing is accepted into the mempool, these are still relayed:

    https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L4462

  17. in src/main.cpp: in b04dcb0b04 outdated
    4450@@ -4451,7 +4451,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
    4451             assert(recentRejects);
    4452             recentRejects->insert(tx.GetHash());
    4453 
    4454-            if (pfrom->fWhitelisted) {
    4455+            if (pfrom->fWhitelisted && GetBoolArg("-whitelistalwaysrelay", true)) {
    


    laanwj commented at 10:58 am on November 12, 2015:
    Please define a static const bool DEFAULT_WHITELISTALWAYSRELAY = true; in main.h and use that (sorry for making your patch even more hideously huge)

    MarcoFalke commented at 11:01 am on November 12, 2015:
    Also, HelpMessage needs update?

    MarcoFalke commented at 11:18 am on November 12, 2015:
    @pstratem You can hide them behind showDebug.
  18. pstratem commented at 11:15 am on November 12, 2015: contributor

    @MarcoFalke I’m not sure we cant to put either of these options in the HelpMessage

    Unless you know what you’re doing these are really not a good idea to change.

  19. jonasschnelli commented at 11:20 am on November 12, 2015: contributor
    @pstratem: for the sake of a central startup arguments “documentation” I think we need to add a help message for every startup parameter. If it’s a debugging/expert only feature, it should be placed behind the -debughelp wall.
  20. petertodd commented at 10:28 pm on November 12, 2015: contributor
    We really should define something like NODE_BLOCKS and NODE_TXS… Doesn’t necessarily need to be in this pull, but worth noting.
  21. pstratem commented at 0:30 am on November 13, 2015: contributor
    @petertodd agreed
  22. gmaxwell commented at 7:35 pm on November 13, 2015: contributor
    Needs rebase. And my tested/code ack is held only on the fact that there is a global static setting for the default thats not used everywhere. :(
  23. laanwj commented at 8:03 am on November 14, 2015: member

    There was also talk about sending an empty filterload to peers in this mode, if they support NODE_BLOOM. Let’s do this (if still relevant) in a later pull, just mentioning it for completeness.

    Edit: utACK

  24. gmaxwell commented at 8:06 am on November 14, 2015: contributor
    @laanwj We don’t need to send an empty filterload because the relay flag has the same effect! (and doesn’t require NODE_BLOOM support)
  25. gmaxwell commented at 8:15 am on November 14, 2015: contributor
    @pstratem Move the DEFAULT_BLOCKSONLY to net.h, then you can use it everywhere uniformly and future programmers will not hate you quite so much. (thanks to @laanwj for asking the dumb question I missed. :) )
  26. Add blocksonly mode 4044f07d1c
  27. Do not process tx inv's in blocksonly mode 420fa8143a
  28. Add whitelistalwaysrelay option 3a964973fe
  29. Add help text for blocksonly and whitelistalwaysrelay 762b13b4d8
  30. Use DEFAULT_BLOCKSONLY and DEFAULT_WHITELISTALWAYSRELAY constants 71a2683f4b
  31. Display DEFAULT_WHITELISTALWAYSRELAY in help text 59441a0445
  32. Fix fRelayTxs comment 6a4982fb83
  33. Fix comment for blocksonly parameter interactions bbf49da408
  34. gmaxwell merged this on Nov 14, 2015
  35. gmaxwell closed this on Nov 14, 2015

  36. gmaxwell referenced this in commit b632145ede on Nov 14, 2015
  37. rebroad commented at 7:13 pm on March 16, 2016: contributor
    Erk.. This is really ugly… And the pull doesn’t even state who needs this functionality or why.
  38. luke-jr commented at 9:56 pm on March 16, 2016: member
    @rebroad Basically this makes Core a blockchain-only node and disables off-chain transactions.
  39. gmaxwell commented at 10:37 pm on March 16, 2016: contributor
    @rebroad It’s fairly self explanatory. If you want to run a node that only processes blocks (e.g. don’t care about unconfirmed transactions); you can set this and save ~80% of your bandwidth, including all redundant transmission of block data; “Blocksonly”. This is good for many applications (including my laptop… :) )
  40. rebroad commented at 11:04 am on March 17, 2016: contributor
    Ah, I thought I had raised a pull request for my Antisocial fork, but it seems not. I think it would be useful to have an option to do blocksonly during IBD only. Would this be of interest to anyone?
  41. laanwj commented at 11:20 am on March 17, 2016: member

    to do blocksonly during IBD only @rebroad That should already be the case? Most node functionality, such as requesting transactions, is disabled during IBD

  42. zkbot referenced this in commit f1aeaec471 on Mar 21, 2018
  43. zkbot referenced this in commit 4fc490c430 on Dec 4, 2019
  44. zkbot referenced this in commit 868c63f92d on Dec 4, 2019
  45. zkbot referenced this in commit ba4eb241e7 on Mar 31, 2021
  46. DrahtBot locked this on Sep 8, 2021

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: 2025-07-16 15:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me