Prevent coredump when -proxy=... -externalip=... is used
Replace an assert() in Unserialize() with the actual behavior we want, i.e. making sure that vRandom is empty. Before the assert() was added, the code called Clear() which ensured vRandom was empty. Clear() was changed to the assert() in BTC commit b138973a8b4bbe061ad97011f278a21e08ea79e6 to prevent recursive locks but risks crashing the node. Instead, we just empty out vRandom. The addition of EXCLUSIVE_LOCKS_REQUIRED is not needed to fix this but seems prudent since Serialize() has it and the original code from BTC has EXCLUSIVE_LOCKS_REQUIRED on all the methods of this class. As a side note, crashing a full node with an assert() and possibly corrupting the wallet.dat, block files and other data is REALLY FUCKING DUMB. Instead, code should be written to prevent the possibility of crashing or throw an exception with a useful error.
This commit is contained in:
@@ -2277,8 +2277,8 @@ void StartNode(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
}
|
||||
|
||||
uiInterface.InitMessage(_("Loading addresses..."));
|
||||
// Load addresses for peers.dat
|
||||
int64_t nStart = GetTimeMillis();
|
||||
fprintf(stderr, "%s: Loading addresses for peers.dat at %ld\n", __func__, nStart);
|
||||
{
|
||||
CAddrDB adb;
|
||||
if (!adb.Read(addrman))
|
||||
|
||||
Reference in New Issue
Block a user