MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / MakeMock

Method MakeMock

src/wallet/db.cpp:119–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119void CDBEnv::MakeMock()
120{
121 if (fDbEnvInit)
122 throw runtime_error("CDBEnv::MakeMock: Already initialized");
123
124 boost::this_thread::interruption_point();
125
126 LogPrint("db", "CDBEnv::MakeMock\n");
127
128 dbenv->set_cachesize(1, 0, 1);
129 dbenv->set_lg_bsize(10485760 * 4);
130 dbenv->set_lg_max(10485760);
131 dbenv->set_lk_max_locks(10000);
132 dbenv->set_lk_max_objects(10000);
133 dbenv->set_flags(DB_AUTO_COMMIT, 1);
134 dbenv->log_set_config(DB_LOG_IN_MEMORY, 1);
135 int ret = dbenv->open(NULL,
136 DB_CREATE |
137 DB_INIT_LOCK |
138 DB_INIT_LOG |
139 DB_INIT_MPOOL |
140 DB_INIT_TXN |
141 DB_THREAD |
142 DB_PRIVATE,
143 S_IRUSR | S_IWUSR);
144 if (ret > 0)
145 throw runtime_error(strprintf("CDBEnv::MakeMock: Error %d opening database environment.", ret));
146
147 fDbEnvInit = true;
148 fMockDb = true;
149}
150
151CDBEnv::VerifyResult CDBEnv::Verify(const std::string& strFile, bool (*recoverFunc)(CDBEnv& dbenv, const std::string& strFile))
152{

Callers 1

TestingSetupMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestingSetupMethod · 0.64