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
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
Force pushed a copy'n'paste fix: s/bool InitParameterInteraction()/void InitParameterInteraction().
Credits to @MarcoFalke on IRC.
Concept ACK.
Concept ACK
ACK
397 | @@ -381,7 +398,7 @@ void BitcoinApplication::startThread() 398 | if(coreThread) 399 | return; 400 | coreThread = new QThread(this); 401 | - BitcoinCore *executor = new BitcoinCore(); 402 | + executor = new BitcoinCore(); 403 | executor->moveToThread(coreThread);
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.
Rebased and fixed the pointer access after moveToThread by following @laanwj advice.
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?
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.
utACK 51627cc
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.
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).
$ 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
$ ~/bitcoin* -regtest -connect=127.0.0.1 -debug=1 -printtoconsole |grep parameter
concept ACK / utACK
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).
@jonasschnelli I am happy to test but the debug.log issue seems not yet resolved? Am I missing something?
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.
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().
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
utACK 296c42e
846 | -#ifdef ENABLE_WALLET 847 | - if (SoftSetBoolArg("-walletbroadcast", false)) 848 | - LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__); 849 | -#endif 850 | - } 851 | -
@jonasschnelli Trivial white space rebase conflict due to 9a3e1a59dfed7cb0cf07a34f75d692280aecf2a6. (Looks like you can ignore changes made in master)
Thanks @MarcoFalke: rebased!