From b426948b966405b65f3ea6c1994164b462980694 Mon Sep 17 00:00:00 2001 From: Bitflash Date: Sat, 1 Aug 2026 12:44:04 -0300 Subject: mine: remember whether this node was mining, with the command line winning (#84) --- src/main.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main.h') diff --git a/src/main.h b/src/main.h index 7266e3d..a50485f 100644 --- a/src/main.h +++ b/src/main.h @@ -64,9 +64,8 @@ extern CBlockIndex* pindexBest; extern unsigned int nTransactionsUpdated; extern string strSetDataDir; extern int nDropMessagesTest; -// Mining mode -- persisted in wallet.dat -// Mining mode -- decided fresh every launch (CLI flags, else default). Never -// restored from wallet.dat; see LoadWallet() in db.cpp. +// Mining mode -- remembered in wallet.dat, but the command line always wins. +// See LoadWallet() in db.cpp for why the precedence has to be explicit. // MINE_RELAY (0): default. Node runs/syncs, never mines, no pool server. // MINE_SOLO (1): mine to own wallet, no pool server // MINE_OPERATOR (2): run pool server, mine to own wallet, distribute to miners @@ -76,6 +75,10 @@ extern int nDropMessagesTest; #define MINE_OPERATOR 2 #define MINE_PARTICIPANT 3 extern int nMineMode; +// Set by the startup parser when a flag chose the mode. LoadWallet leaves the +// stored mode alone when this is true, so a flag is never silently overruled by +// something a previous session wrote. +extern bool fMineModeFromCommandLine; extern string strParticipantPool; // participant: pool .btf address extern string strPoolName; // operator: announced pool name extern string strPoolDashboardUrl; // operator: optional dashboard URL -- cgit v1.2.3