diff --git a/src/avalanche/processor.cpp b/src/avalanche/processor.cpp --- a/src/avalanche/processor.cpp +++ b/src/avalanche/processor.cpp @@ -6,6 +6,7 @@ #include #include +#include // For DecodeSecret #include #include #include @@ -148,8 +149,12 @@ Processor::Processor(interfaces::Chain &chain, CConnman *connmanIn) : connman(connmanIn), queryTimeoutDuration(AVALANCHE_DEFAULT_QUERY_TIMEOUT), round(0), peerManager(std::make_unique()) { - // Pick a random key for the session. - sessionKey.MakeNewKey(true); + if (gArgs.IsArgSet("-avasessionkey")) { + sessionKey = DecodeSecret(gArgs.GetArg("-avasessionkey", "")); + } else { + // Pick a random key for the session. + sessionKey.MakeNewKey(true); + } // Make sure we get notified of chain state changes. chainNotificationsHandler = diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -1195,6 +1195,8 @@ strprintf("Mandatory cooldown between two avapoll (default: %u)", AVALANCHE_DEFAULT_COOLDOWN), ArgsManager::ALLOW_ANY, OptionsCategory::AVALANCHE); + gArgs.AddArg("-avasessionkey", "Avalanche session key (default: random)", + ArgsManager::ALLOW_ANY, OptionsCategory::AVALANCHE); // Add the hidden options gArgs.AddHiddenArgs(hidden_args);