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

Call init's parameter interaction before we create the UI options model #6780

Merged
merged 4 commits into from Nov 27, 2015

Conversation

jonasschnelli
Copy link
Contributor

@jonasschnelli jonasschnelli commented Oct 8, 2015

Currently optionsModel(QT) parameters interaction overwrites/dominates initial and depending parameter settings. This PR would factor out init's parameter interaction and call it before AppInit2().

Fixes #6773

@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Oct 8, 2015

Force pushed a copy'n'paste fix: s/bool InitParameterInteraction()/void InitParameterInteraction().
Credits to @MarcoFalke on IRC.

@MarcoFalke
Copy link
Member

MarcoFalke commented Oct 8, 2015

Concept ACK.

@laanwj laanwj added the GUI label Oct 8, 2015
@laanwj
Copy link
Member

laanwj commented Oct 8, 2015

Concept ACK

@paveljanik
Copy link
Contributor

paveljanik commented Oct 8, 2015

ACK

@@ -381,7 +398,7 @@ void BitcoinApplication::startThread()
if(coreThread)
return;
coreThread = new QThread(this);
BitcoinCore *executor = new BitcoinCore();
executor = new BitcoinCore();
executor->moveToThread(coreThread);
Copy link
Member

@laanwj laanwj Oct 30, 2015

Choose a reason for hiding this comment

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

It's not allowed to use this object [from this thread] after moving it to another thread.
I'd suggest calling InitParameterInteraction() directly from BitcoinApplication::parameterSetup() and not bothering with the stuff in BitcoinCore.

@jonasschnelli jonasschnelli force-pushed the 2015/10/qt_fix_listen branch 3 times, most recently from abc1843 to 648d812 Compare Nov 13, 2015
@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Nov 13, 2015

Rebased and fixed the pointer access after moveToThread by following @laanwj advice.

@gmaxwell
Copy link
Contributor

gmaxwell commented Nov 17, 2015

Sorry, blocksonly mode caused a need for a small change here, as it needs to get moved. @jonasschnelli mind rebasing?

What about that prune/txindex "interaction" (fails to run), should it move too?

@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Nov 17, 2015

Sorry, blocksonly mode caused a need for a small change here, as it needs to get moved. @jonasschnelli mind rebasing?

Just rebased and moved the -blocksonly interaction to the new function.

What about that prune/txindex "interaction" (fails to run), should it move too?

My idea was to only move "rules" to the new function. Things that evaluate parameters through GetBoolArg or mapArgs, etc. and depending on its state, optional change another startup variable through SoftSetBoolArg, etc.

Pruning and TxIndex are checks that lead to a InitError() (startup termination) and it would require to move the InitError() context to the ParameterInteraction() function.

@MarcoFalke
Copy link
Member

MarcoFalke commented Nov 17, 2015

utACK 51627cc

@jonasschnelli jonasschnelli added this to the 0.12.0 milestone Nov 18, 2015
@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Nov 21, 2015

Would be nice if someone finds time to test this. Binaries: https://bitcoin.jonasschnelli.ch/pulls/6780/
This fixes a ugly bug (#6773) which would be nice to have fixed in 0.12.

@fanquake
Copy link
Member

fanquake commented Nov 21, 2015

Will do.

On Saturday, November 21, 2015, Jonas Schnelli notifications@github.com
wrote:

Would be nice if someone finds time to test this. Binaries:
https://bitcoin.jonasschnelli.ch/pulls/6780/
This fixes a ugly bug (#6773
#6773) which would be nice to
have fixed in 0.12.


Reply to this email directly or view it on GitHub
#6780 (comment).

@MarcoFalke
Copy link
Member

MarcoFalke commented Nov 21, 2015

@jonasschnelli

  • master:
$ src/bitcoind -regtest -connect=127.0.0.1 -server -printtoconsole |grep parameter 
2015-11-21 17:52:56 AppInit2: parameter interaction: -connect set -> setting -dnsseed=0
2015-11-21 17:52:56 AppInit2: parameter interaction: -connect set -> setting -listen=0
2015-11-21 17:52:56 AppInit2: parameter interaction: -listen=0 -> setting -upnp=0
2015-11-21 17:52:56 AppInit2: parameter interaction: -listen=0 -> setting -discover=0
2015-11-21 17:52:56 AppInit2: parameter interaction: -listen=0 -> setting -listenonion=0

$ src/qt/bitcoin-qt -regtest -connect=127.0.0.1 -server -printtoconsole |grep parameter 
2015-11-21 17:53:34 AppInit2: parameter interaction: -connect set -> setting -dnsseed=0
  • 51627cc
$ ~/bitcoin* -regtest -connect=127.0.0.1 -debug=1 -printtoconsole |grep parameter 

@dcousens
Copy link
Contributor

dcousens commented Nov 24, 2015

concept ACK / utACK

@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Nov 26, 2015

I'd like to take this into 0.12 because it fixes a slightly security-critical issue (#6773). Some tested ACKs would be nice (another 5 days left until feature freeze).

@MarcoFalke
Copy link
Member

MarcoFalke commented Nov 26, 2015

@jonasschnelli I am happy to test but the debug.log issue seems not yet resolved? Am I missing something?

@laanwj
Copy link
Member

laanwj commented Nov 26, 2015

utACK. Agree it needs to be in 0.12

Haven't tested any specific cases - I've been holding off on this because the parameter processing is kind of fragile and I haven't properly reasoned it through yet that this doesn't have effect on the precedence of options specified in e.g. configuration files, command line, QSettings.

@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Nov 26, 2015

Thanks @MarcoFalke for pointing out the logging issue. Added another commit that moves the logging initialization.

For reviewers: The critical part are the first 100 lines in AppInit2() because the logging init and the parameter interactions are now before AppInit2().

@MarcoFalke
Copy link
Member

MarcoFalke commented Nov 27, 2015

Sanity tests pass now:

$ src/bitcoind -regtest -connect=127.0.0.1 -server -printtoconsole |egrep "(parameter|Bitcoin)"
2015-11-27 07:39:08 Bitcoin version v0.11.99.0-296c42e (2015-11-26 14:03:27 +0100)
2015-11-27 07:39:08 InitParameterInteraction: parameter interaction: -connect set -> setting -dnsseed=0
2015-11-27 07:39:08 InitParameterInteraction: parameter interaction: -connect set -> setting -listen=0
2015-11-27 07:39:08 InitParameterInteraction: parameter interaction: -listen=0 -> setting -upnp=0
2015-11-27 07:39:08 InitParameterInteraction: parameter interaction: -listen=0 -> setting -discover=0
2015-11-27 07:39:08 InitParameterInteraction: parameter interaction: -listen=0 -> setting -listenonion=0

$ src/qt/bitcoin-qt -regtest -connect=127.0.0.1 -server -printtoconsole |egrep "(parameter|Bitcoin)"
2015-11-27 07:53:02 Bitcoin version v0.11.99.0-296c42e (2015-11-26 14:03:27 +0100)
2015-11-27 07:53:02 InitParameterInteraction: parameter interaction: -connect set -> setting -dnsseed=0
2015-11-27 07:53:02 InitParameterInteraction: parameter interaction: -connect set -> setting -listen=0
2015-11-27 07:53:02 InitParameterInteraction: parameter interaction: -listen=0 -> setting -upnp=0
2015-11-27 07:53:02 InitParameterInteraction: parameter interaction: -listen=0 -> setting -discover=0
2015-11-27 07:53:02 InitParameterInteraction: parameter interaction: -listen=0 -> setting -listenonion=0

@MarcoFalke
Copy link
Member

MarcoFalke commented Nov 27, 2015

utACK 296c42e

LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
#endif
}

Copy link
Member

@MarcoFalke MarcoFalke Nov 27, 2015

Choose a reason for hiding this comment

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

@jonasschnelli Trivial white space rebase conflict due to 9a3e1a5. (Looks like you can ignore changes made in master)

@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Nov 27, 2015

Thanks @MarcoFalke: rebased!

@laanwj laanwj merged commit a46f87f into bitcoin:master Nov 27, 2015
1 check was pending
laanwj added a commit that referenced this issue Nov 27, 2015
a46f87f Initialize logging before we do parameter interaction (Jonas Schnelli)
df66147 Move -blocksonly parameter interaction to the new ParameterInteraction() function (Jonas Schnelli)
68354e7 [QT] Call inits parameter interaction before we create the options model (Jonas Schnelli)
411b05a Refactor parameter interaction, call it before AppInit2() (Jonas Schnelli)
zkbot added a commit to zcash/zcash that referenced this issue 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 issue 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 issue 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.
random-zebra added a commit to PIVX-Project/PIVX that referenced this issue Mar 12, 2020
…odel

9182b90 Initialize logging before we do parameter interaction (Jonas Schnelli)
dec0787 [QT] Call inits parameter interaction before we create the options model (Jonas Schnelli)
18480ce Refactor parameter interaction, call it before AppInit2() (Jonas Schnelli)

Pull request description:

  Backport of bitcoin#6780

  Currently optionsModel(QT) parameters interaction overwrites/dominates initial and depending parameter settings. This PR would factor out init's parameter interaction and call it before AppInit2().

ACKs for top commit:
  furszy:
    ACK 9182b90
  random-zebra:
    ACK rebase 9182b90 and merging...

Tree-SHA512: f01c9b6603452d59c3fa7df8b8f85998b9c716fd3209f80fc6d4591035c995ad577b217d1d7ffd7f642d16fe130ee922ba0394870ec391b8e972587022962611
akshaynexus pushed a commit to ZENZO-Ecosystem/ZENZO-Core that referenced this issue Mar 13, 2020
…ing the UI model

9182b90 Initialize logging before we do parameter interaction (Jonas Schnelli)
dec0787 [QT] Call inits parameter interaction before we create the options model (Jonas Schnelli)
18480ce Refactor parameter interaction, call it before AppInit2() (Jonas Schnelli)

Pull request description:

  Backport of bitcoin#6780

  Currently optionsModel(QT) parameters interaction overwrites/dominates initial and depending parameter settings. This PR would factor out init's parameter interaction and call it before AppInit2().

ACKs for top commit:
  furszy:
    ACK 9182b90
  random-zebra:
    ACK rebase 9182b90 and merging...

Tree-SHA512: f01c9b6603452d59c3fa7df8b8f85998b9c716fd3209f80fc6d4591035c995ad577b217d1d7ffd7f642d16fe130ee922ba0394870ec391b8e972587022962611
akshaynexus pushed a commit to ZENZO-Ecosystem/ZENZO-Core that referenced this issue Mar 15, 2020
…ing the UI model

9182b90 Initialize logging before we do parameter interaction (Jonas Schnelli)
dec0787 [QT] Call inits parameter interaction before we create the options model (Jonas Schnelli)
18480ce Refactor parameter interaction, call it before AppInit2() (Jonas Schnelli)

Pull request description:

  Backport of bitcoin#6780

  Currently optionsModel(QT) parameters interaction overwrites/dominates initial and depending parameter settings. This PR would factor out init's parameter interaction and call it before AppInit2().

ACKs for top commit:
  furszy:
    ACK 9182b90
  random-zebra:
    ACK rebase 9182b90 and merging...

Tree-SHA512: f01c9b6603452d59c3fa7df8b8f85998b9c716fd3209f80fc6d4591035c995ad577b217d1d7ffd7f642d16fe130ee922ba0394870ec391b8e972587022962611
akshaynexus pushed a commit to ZENZO-Ecosystem/ZENZO-Core that referenced this issue Mar 15, 2020
…ing the UI model

9182b90 Initialize logging before we do parameter interaction (Jonas Schnelli)
dec0787 [QT] Call inits parameter interaction before we create the options model (Jonas Schnelli)
18480ce Refactor parameter interaction, call it before AppInit2() (Jonas Schnelli)

Pull request description:

  Backport of bitcoin#6780

  Currently optionsModel(QT) parameters interaction overwrites/dominates initial and depending parameter settings. This PR would factor out init's parameter interaction and call it before AppInit2().

ACKs for top commit:
  furszy:
    ACK 9182b90
  random-zebra:
    ACK rebase 9182b90 and merging...

Tree-SHA512: f01c9b6603452d59c3fa7df8b8f85998b9c716fd3209f80fc6d4591035c995ad577b217d1d7ffd7f642d16fe130ee922ba0394870ec391b8e972587022962611
akshaynexus pushed a commit to ZENZO-Ecosystem/ZENZO-Core that referenced this issue Mar 15, 2020
…ing the UI model

9182b90 Initialize logging before we do parameter interaction (Jonas Schnelli)
dec0787 [QT] Call inits parameter interaction before we create the options model (Jonas Schnelli)
18480ce Refactor parameter interaction, call it before AppInit2() (Jonas Schnelli)

Pull request description:

  Backport of bitcoin#6780

  Currently optionsModel(QT) parameters interaction overwrites/dominates initial and depending parameter settings. This PR would factor out init's parameter interaction and call it before AppInit2().

ACKs for top commit:
  furszy:
    ACK 9182b90
  random-zebra:
    ACK rebase 9182b90 and merging...

Tree-SHA512: f01c9b6603452d59c3fa7df8b8f85998b9c716fd3209f80fc6d4591035c995ad577b217d1d7ffd7f642d16fe130ee922ba0394870ec391b8e972587022962611
akshaynexus pushed a commit to ZENZO-Ecosystem/ZENZO-Core that referenced this issue Mar 15, 2020
…ing the UI model

9182b90 Initialize logging before we do parameter interaction (Jonas Schnelli)
dec0787 [QT] Call inits parameter interaction before we create the options model (Jonas Schnelli)
18480ce Refactor parameter interaction, call it before AppInit2() (Jonas Schnelli)

Pull request description:

  Backport of bitcoin#6780

  Currently optionsModel(QT) parameters interaction overwrites/dominates initial and depending parameter settings. This PR would factor out init's parameter interaction and call it before AppInit2().

ACKs for top commit:
  furszy:
    ACK 9182b90
  random-zebra:
    ACK rebase 9182b90 and merging...

Tree-SHA512: f01c9b6603452d59c3fa7df8b8f85998b9c716fd3209f80fc6d4591035c995ad577b217d1d7ffd7f642d16fe130ee922ba0394870ec391b8e972587022962611
wqking pushed a commit to wqking-temp/Vitae that referenced this issue Aug 13, 2020
…odel

9182b9007559fa6ae945b1e13984dc1971572c28 Initialize logging before we do parameter interaction (Jonas Schnelli)
dec078739aca63be8dc7c6e2fbb8267c2dfa86c3 [QT] Call inits parameter interaction before we create the options model (Jonas Schnelli)
18480ce73994d9326b27a0ff7a034e71ec5f0dce Refactor parameter interaction, call it before AppInit2() (Jonas Schnelli)

Pull request description:

  Backport of bitcoin/bitcoin#6780

  Currently optionsModel(QT) parameters interaction overwrites/dominates initial and depending parameter settings. This PR would factor out init's parameter interaction and call it before AppInit2().

ACKs for top commit:
  furszy:
    ACK 9182b90
  random-zebra:
    ACK rebase 9182b9007559fa6ae945b1e13984dc1971572c28 and merging...

Tree-SHA512: f01c9b6603452d59c3fa7df8b8f85998b9c716fd3209f80fc6d4591035c995ad577b217d1d7ffd7f642d16fe130ee922ba0394870ec391b8e972587022962611

# Conflicts:
#	src/init.cpp
zkbot added a commit to zcash/zcash that referenced this issue 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.

7 participants