Skip to content

Commit

Permalink
options: add a comment for -listenonion and dedup a long expression
Browse files Browse the repository at this point in the history
A followup to #568

Co-authored-by: Jon Atack <[email protected]>
  • Loading branch information
vasild and jonatack committed Mar 24, 2022
1 parent 0a14a16 commit 66fe59c
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/qt/optionsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,26 @@ void OptionsModel::Init(bool resetSettings)

if (!settings.contains("fListen"))
settings.setValue("fListen", DEFAULT_LISTEN);
if (!gArgs.SoftSetBoolArg("-listen", settings.value("fListen").toBool())) {
const bool listen{settings.value("fListen").toBool()};
if (!gArgs.SoftSetBoolArg("-listen", listen)) {
addOverriddenOption("-listen");
} else if (!settings.value("fListen").toBool()) {
} else if (!listen) {
// We successfully set -listen=0, thus mimic the logic from InitParameterInteraction():
// "parameter interaction: -listen=0 -> setting -listenonion=0".
//
// Both -listen and -listenonion default to true.
//
// The call order is:
//
// InitParameterInteraction()
// would set -listenonion=0 if it sees -listen=0, but for bitcoin-qt with
// fListen=false -listen is 1 at this point
//
// OptionsModel::Init()
// this method, can flip -listen from 1 to 0 if fListen=false
//
// AppInitParameterInteraction()
// error if -listen=0 and -listenonion=1
gArgs.SoftSetBoolArg("-listenonion", false);
}

Expand Down

0 comments on commit 66fe59c

Please sign in to comment.