mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Make SHAMapNode::ClassInit self-invoking.
This commit is contained in:
@@ -52,7 +52,6 @@ void Application::stop()
|
||||
void Application::run()
|
||||
{
|
||||
assert(mTxnDB==NULL);
|
||||
SHAMapNode::ClassInit();
|
||||
|
||||
//
|
||||
// Construct databases.
|
||||
|
||||
@@ -670,7 +670,6 @@ BOOST_AUTO_TEST_SUITE(shamap)
|
||||
|
||||
BOOST_AUTO_TEST_CASE( SHAMap_test )
|
||||
{ // h3 and h4 differ only in the leaf, same terminal node (level 19)
|
||||
SHAMapNode::ClassInit();
|
||||
uint256 h1, h2, h3, h4, h5;
|
||||
h1.SetHex("092891fe4ef6cee585fdc6fda0e09eb4d386363158ec3321b8123e5a772c6ca7");
|
||||
h2.SetHex("436ccbac3347baa1f1e53baeef1f43334da88f1f6d70d963b833afd6dfa289fe");
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
virtual std::string getString() const;
|
||||
void dump() const;
|
||||
|
||||
static void ClassInit();
|
||||
static bool ClassInit();
|
||||
static uint256 getNodeID(int depth, const uint256& hash);
|
||||
|
||||
// Convert to/from wire format (256-bit nodeID, 1-byte depth)
|
||||
|
||||
@@ -69,7 +69,9 @@ bool SHAMapNode::operator!=(const uint256 &s) const
|
||||
return s!=mNodeID;
|
||||
}
|
||||
|
||||
void SHAMapNode::ClassInit()
|
||||
static bool j = SHAMapNode::ClassInit();
|
||||
|
||||
bool SHAMapNode::ClassInit()
|
||||
{ // set up the depth masks
|
||||
uint256 selector;
|
||||
for(int i = 0; i < 64; i += 2)
|
||||
@@ -80,6 +82,7 @@ void SHAMapNode::ClassInit()
|
||||
*(selector.begin() + (i / 2)) = 0xFF;
|
||||
}
|
||||
smMasks[64] = selector;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint256 SHAMapNode::getNodeID(int depth, const uint256& hash)
|
||||
|
||||
@@ -366,7 +366,6 @@ BOOST_AUTO_TEST_CASE( SHAMapSync_test )
|
||||
unsigned int seed;
|
||||
RAND_pseudo_bytes(reinterpret_cast<unsigned char *>(&seed), sizeof(seed));
|
||||
srand(seed);
|
||||
SHAMapNode::ClassInit();
|
||||
|
||||
SHAMap source, destination;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user