Skip to content
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

Add -blocksonly option #6993

Merged
merged 8 commits into from Nov 14, 2015
Merged

Add -blocksonly option #6993

merged 8 commits into from Nov 14, 2015

Conversation

pstratem
Copy link
Contributor

@pstratem pstratem commented Nov 12, 2015

Set fRelay=false and reject all transactions into the mempool

@dcousens
Copy link
Contributor

dcousens commented Nov 12, 2015

Concept ACK

@luke-jr
Copy link
Member

luke-jr commented Nov 12, 2015

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

@gmaxwell
Copy link
Contributor

gmaxwell commented Nov 12, 2015

@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.

@luke-jr
Copy link
Member

luke-jr commented Nov 12, 2015

As the code is right now, I don't think you can submit txns...

@gmaxwell
Copy link
Contributor

gmaxwell commented Nov 12, 2015

@luke-jr Yup see my comment. :)

@pstratem
Copy link
Contributor Author

pstratem commented Nov 12, 2015

@gmaxwell and ruin my record for smallest patch to add a new feature? :)

@gmaxwell
Copy link
Contributor

gmaxwell commented Nov 12, 2015

Perhaps there is a reason it was record setting? :P

@gmaxwell
Copy link
Contributor

gmaxwell commented Nov 12, 2015

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?

@paveljanik
Copy link
Contributor

paveljanik commented Nov 12, 2015

The option should be documented, so yet another line is needed :-)

@paveljanik
Copy link
Contributor

paveljanik commented Nov 12, 2015

What will we do to remote peers relaying transactions to us ignoring we announced that we do not want transactions in version message?

@laanwj laanwj added the P2P label Nov 12, 2015
@laanwj
Copy link
Member

laanwj commented Nov 12, 2015

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.

@jonasschnelli
Copy link
Contributor

jonasschnelli commented Nov 12, 2015

Concept ACK.
Agree with @paveljanik: needs a help message line and maybe a comment on src/net.cpp:L454.

@MarcoFalke
Copy link
Member

MarcoFalke commented Nov 12, 2015

Otherwise there's already -walletbroadcast=0

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

@laanwj
Copy link
Member

laanwj commented Nov 12, 2015

@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

@@ -4451,7 +4451,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
assert(recentRejects);
recentRejects->insert(tx.GetHash());

if (pfrom->fWhitelisted) {
if (pfrom->fWhitelisted && GetBoolArg("-whitelistalwaysrelay", true)) {
Copy link
Member

@laanwj laanwj Nov 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please define a static const bool DEFAULT_WHITELISTALWAYSRELAY = true; in main.h and use that
(sorry for making your patch even more hideously huge)

Copy link
Member

@MarcoFalke MarcoFalke Nov 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, HelpMessage needs update?

Copy link
Member

@MarcoFalke MarcoFalke Nov 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pstratem You can hide them behind showDebug.

@pstratem
Copy link
Contributor Author

pstratem commented Nov 12, 2015

@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.

@jonasschnelli
Copy link
Contributor

jonasschnelli commented Nov 12, 2015

@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.

@petertodd
Copy link
Contributor

petertodd commented Nov 12, 2015

We really should define something like NODE_BLOCKS and NODE_TXS... Doesn't necessarily need to be in this pull, but worth noting.

@pstratem
Copy link
Contributor Author

pstratem commented Nov 13, 2015

@petertodd agreed

@gmaxwell
Copy link
Contributor

gmaxwell commented Nov 13, 2015

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. :(

@laanwj
Copy link
Member

laanwj commented Nov 14, 2015

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

@gmaxwell
Copy link
Contributor

gmaxwell commented Nov 14, 2015

@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)

@gmaxwell
Copy link
Contributor

gmaxwell commented Nov 14, 2015

@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. :) )

@gmaxwell gmaxwell merged commit bbf49da into bitcoin:master Nov 14, 2015
gmaxwell added a commit that referenced this pull request Nov 14, 2015
bbf49da Fix comment for blocksonly parameter interactions (Patick Strateman)
6a4982f Fix fRelayTxs comment (Patick Strateman)
59441a0 Display DEFAULT_WHITELISTALWAYSRELAY in help text (Patick Strateman)
71a2683 Use DEFAULT_BLOCKSONLY and DEFAULT_WHITELISTALWAYSRELAY constants (Patick Strateman)
762b13b Add help text for blocksonly and whitelistalwaysrelay (Patick Strateman)
3a96497 Add whitelistalwaysrelay option (Patick Strateman)
420fa81 Do not process tx inv's in blocksonly mode (Patick Strateman)
4044f07 Add blocksonly mode (Patick Strateman)
@rebroad
Copy link
Contributor

rebroad commented Mar 16, 2016

Erk.. This is really ugly... And the pull doesn't even state who needs this functionality or why.

@luke-jr
Copy link
Member

luke-jr commented Mar 16, 2016

@rebroad Basically this makes Core a blockchain-only node and disables off-chain transactions.

@gmaxwell
Copy link
Contributor

gmaxwell commented Mar 16, 2016

@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... :) )

@rebroad
Copy link
Contributor

rebroad commented Mar 17, 2016

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?

@laanwj
Copy link
Member

laanwj commented Mar 17, 2016

to do blocksonly during IBD only

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

zkbot added a commit to zcash/zcash that referenced this pull request Mar 21, 2018
Misc upstream PRs

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6077
  - Second commit only (first was already applied to 0.11.X and then reverted)
- bitcoin/bitcoin#6284
- bitcoin/bitcoin#6489
- bitcoin/bitcoin#6462
- bitcoin/bitcoin#6647
- bitcoin/bitcoin#6235
- bitcoin/bitcoin#6905
- bitcoin/bitcoin#6780
  - Excluding second commit (QT) and third commit (requires bitcoin/bitcoin#6993)
- bitcoin/bitcoin#6961
  - Excluding QT parts, and a small `src/policy/policy.cpp` change which depends on a bunch of other PRs, which we'll have to remember to come back to.
- bitcoin/bitcoin#7044
- bitcoin/bitcoin#8856
- bitcoin/bitcoin#9002

Part of #2074 and #2132.
zkbot added a commit to zcash/zcash that referenced this pull request Dec 4, 2019
Misc upstream PRs

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6077
  - Second commit only (first was already applied to 0.11.X and then reverted)
- bitcoin/bitcoin#6284
- bitcoin/bitcoin#6489
- bitcoin/bitcoin#6235
- bitcoin/bitcoin#6905
- bitcoin/bitcoin#6780
  - Excluding second commit (QT) and third commit (requires bitcoin/bitcoin#6993)
- bitcoin/bitcoin#6961
  - Excluding QT parts, and a small `src/policy/policy.cpp` change which depends on a bunch of other PRs, which we'll have to remember to come back to.
- bitcoin/bitcoin#7044
- bitcoin/bitcoin#8856
- bitcoin/bitcoin#9002

Part of #2074 and #2132.
zkbot added a commit to zcash/zcash that referenced this pull request Dec 4, 2019
Misc upstream PRs

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6077
  - Second commit only (first was already applied to 0.11.X and then reverted)
- bitcoin/bitcoin#6284
- bitcoin/bitcoin#6489
- bitcoin/bitcoin#6235
- bitcoin/bitcoin#6905
- bitcoin/bitcoin#6780
  - Excluding second commit (QT) and third commit (requires bitcoin/bitcoin#6993)
- bitcoin/bitcoin#6961
  - Excluding QT parts, and a small `src/policy/policy.cpp` change which depends on a bunch of other PRs, which we'll have to remember to come back to.
- bitcoin/bitcoin#7044
- bitcoin/bitcoin#8856
- bitcoin/bitcoin#9002

Part of #2074 and #2132.
zkbot added a commit to zcash/zcash that referenced this pull request Mar 31, 2021
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.
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet