Increase test coverage for addrman and addrinfo

This commit is contained in:
Ethan Heilman
2015-12-12 22:34:08 -05:00
committed by lateminer
parent be365a0d15
commit 4661755f32
3 changed files with 387 additions and 49 deletions

View File

@@ -179,9 +179,6 @@ private:
//! critical section to protect the inner data structures
mutable CCriticalSection cs;
//! secret key to randomize bucket select with
uint256 nKey;
//! last used nId
int nIdCount;
@@ -210,6 +207,8 @@ private:
int64_t nLastGood;
protected:
//! secret key to randomize bucket select with
uint256 nKey;
//! Find an entry.
CAddrInfo* Find(const CNetAddr& addr, int *pnId = NULL);
@@ -242,6 +241,9 @@ protected:
//! Select an address to connect to, if newOnly is set to true, only the new table is selected from.
CAddrInfo Select_(bool newOnly);
//! Wraps GetRandInt to allow tests to override RandomInt and make it determinismistic.
virtual int RandomInt(int nMax);
#ifdef DEBUG_ADDRMAN
//! Perform consistency check. Returns an error code or zero.
int Check_();
@@ -580,11 +582,6 @@ public:
Check();
}
}
//! Ensure that bucket placement is always the same for testing purposes.
void MakeDeterministic(){
nKey.SetNull(); //Do not use outside of tests.
}
void SetServices(const CService &addr, uint64_t nServices)
{