diff options
Diffstat (limited to 'src/db.cpp')
| -rw-r--r-- | src/db.cpp | 39 |
1 files changed, 27 insertions, 12 deletions
| @@ -642,16 +642,29 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet) | |||
| 642 | ssKey >> strKey; | 642 | ssKey >> strKey; |
| 643 | if (strKey == "nTransactionFee") ssValue >> nTransactionFee; | 643 | if (strKey == "nTransactionFee") ssValue >> nTransactionFee; |
| 644 | if (strKey == "addrIncoming") ssValue >> addrIncoming; | 644 | if (strKey == "addrIncoming") ssValue >> addrIncoming; |
| 645 | // Mining-mode/pool settings (nMineMode, strParticipantPool, strPoolName, | 645 | |
| 646 | // strPoolDashboardUrl, dPoolFeePercent, fGenerateBitcoins) are intentionally | 646 | // Mining mode is restored, but only when no flag chose one. |
| 647 | // NOT restored here. They used to be, and LoadWallet() runs after CLI flags | 647 | // |
| 648 | // are parsed in main_gui.cpp, so a saved value would silently overwrite | 648 | // These settings used to be restored unconditionally. LoadWallet() |
| 649 | // whatever was just requested on the command line or in a previous Options | 649 | // runs after main_gui.cpp has parsed the command line, so a stored |
| 650 | // session -- no error, no log line. That's what caused pool name/address to | 650 | // value silently overwrote what had just been asked for -- no error, |
| 651 | // show correctly in the UI but stay stale in the logs, and mode to change | 651 | // no log line -- and the fix at the time was to stop restoring them |
| 652 | // behavior across restarts. Mode/pool config is decided fresh every launch | 652 | // at all. That traded a silent override for a different silent |
| 653 | // instead: CLI flags if given, otherwise the compiled-in default. Nothing to | 653 | // failure: a machine set to mine came back from every restart as a |
| 654 | // go stale, nothing to fight over load order. | 654 | // plain relay, looking exactly like one that had been asked to |
| 655 | // relay. A 32-core miner sat idle for hours that way, and the only | ||
| 656 | // evidence was memory usage that never climbed. | ||
| 657 | // | ||
| 658 | // Precedence is now explicit rather than accidental: a flag wins, | ||
| 659 | // and it says so in the log below. Only the two fields that decide | ||
| 660 | // whether this node mines are restored, plus the pool address a | ||
| 661 | // participant cannot work without. | ||
| 662 | if (!fMineModeFromCommandLine) | ||
| 663 | { | ||
| 664 | if (strKey == "nMineMode") ssValue >> nMineMode; | ||
| 665 | if (strKey == "fGenerateBitcoins") ssValue >> fGenerateBitcoins; | ||
| 666 | if (strKey == "strParticipantPool") ssValue >> strParticipantPool; | ||
| 667 | } | ||
| 655 | } | 668 | } |
| 656 | } | 669 | } |
| 657 | } | 670 | } |
| @@ -673,8 +686,10 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet) | |||
| 673 | 686 | ||
| 674 | printf("nTransactionFee = %lld\n", nTransactionFee); | 687 | printf("nTransactionFee = %lld\n", nTransactionFee); |
| 675 | printf("addrIncoming = %s\n", addrIncoming.ToString().c_str()); | 688 | printf("addrIncoming = %s\n", addrIncoming.ToString().c_str()); |
| 676 | printf("nMineMode = %d, strParticipantPool = %s, fGenerateBitcoins = %d (from CLI/default, not wallet.dat)\n", | 689 | printf("nMineMode = %d, strParticipantPool = %s, fGenerateBitcoins = %d (%s)\n", |
| 677 | nMineMode, strParticipantPool.c_str(), fGenerateBitcoins); | 690 | nMineMode, strParticipantPool.c_str(), fGenerateBitcoins, |
| 691 | fMineModeFromCommandLine ? "from the command line, wallet.dat ignored" | ||
| 692 | : "remembered from wallet.dat, or the default"); | ||
| 678 | printf("strPoolName = %s, dPoolFeePercent = %.2f, strPoolDashboardUrl = %s (from CLI/default, not wallet.dat)\n", | 693 | printf("strPoolName = %s, dPoolFeePercent = %.2f, strPoolDashboardUrl = %s (from CLI/default, not wallet.dat)\n", |
| 679 | strPoolName.c_str(), dPoolFeePercent, strPoolDashboardUrl.c_str()); | 694 | strPoolName.c_str(), dPoolFeePercent, strPoolDashboardUrl.c_str()); |
| 680 | 695 | ||