Hush notarization database is too legit to quit
This commit is contained in:
@@ -1759,13 +1759,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
delete pcoinsdbview;
|
delete pcoinsdbview;
|
||||||
delete pcoinscatcher;
|
delete pcoinscatcher;
|
||||||
delete pblocktree;
|
delete pblocktree;
|
||||||
delete pnotarisations;
|
delete pnotarizations;
|
||||||
|
|
||||||
pblocktree = new CBlockTreeDB(nBlockTreeDBCache, false, fReindex, dbCompression, dbMaxOpenFiles);
|
pblocktree = new CBlockTreeDB(nBlockTreeDBCache, false, fReindex, dbCompression, dbMaxOpenFiles);
|
||||||
pcoinsdbview = new CCoinsViewDB(nCoinDBCache, false, fReindex);
|
pcoinsdbview = new CCoinsViewDB(nCoinDBCache, false, fReindex);
|
||||||
pcoinscatcher = new CCoinsViewErrorCatcher(pcoinsdbview);
|
pcoinscatcher = new CCoinsViewErrorCatcher(pcoinsdbview);
|
||||||
pcoinsTip = new CCoinsViewCache(pcoinscatcher);
|
pcoinsTip = new CCoinsViewCache(pcoinscatcher);
|
||||||
pnotarisations = new NotarizationDB(100*1024*1024, false, fReindex);
|
pnotarizations = new NotarizationDB(100*1024*1024, false, fReindex);
|
||||||
|
|
||||||
|
|
||||||
if (fReindex) {
|
if (fReindex) {
|
||||||
|
|||||||
@@ -2910,10 +2910,10 @@ void ConnectNotarizations(const CBlock &block, int height)
|
|||||||
{
|
{
|
||||||
NotarisationsInBlock notarisations = ScanBlockNotarizations(block, height);
|
NotarisationsInBlock notarisations = ScanBlockNotarizations(block, height);
|
||||||
if (notarisations.size() > 0) {
|
if (notarisations.size() > 0) {
|
||||||
CDBBatch batch = CDBBatch(*pnotarisations);
|
CDBBatch batch = CDBBatch(*pnotarizations);
|
||||||
batch.Write(block.GetHash(), notarisations);
|
batch.Write(block.GetHash(), notarisations);
|
||||||
WriteBackNotarisations(notarisations, batch);
|
WriteBackNotarisations(notarisations, batch);
|
||||||
pnotarisations->WriteBatch(batch, true);
|
pnotarizations->WriteBatch(batch, true);
|
||||||
LogPrintf("ConnectBlock: wrote %i block notarizations in block: %s\n",
|
LogPrintf("ConnectBlock: wrote %i block notarizations in block: %s\n",
|
||||||
notarisations.size(), block.GetHash().GetHex().data());
|
notarisations.size(), block.GetHash().GetHex().data());
|
||||||
}
|
}
|
||||||
@@ -2923,10 +2923,10 @@ void DisconnectNotarizations(const CBlock &block)
|
|||||||
{
|
{
|
||||||
NotarisationsInBlock nibs;
|
NotarisationsInBlock nibs;
|
||||||
if (GetBlockNotarisations(block.GetHash(), nibs)) {
|
if (GetBlockNotarisations(block.GetHash(), nibs)) {
|
||||||
CDBBatch batch = CDBBatch(*pnotarisations);
|
CDBBatch batch = CDBBatch(*pnotarizations);
|
||||||
batch.Erase(block.GetHash());
|
batch.Erase(block.GetHash());
|
||||||
EraseBackNotarisations(nibs, batch);
|
EraseBackNotarisations(nibs, batch);
|
||||||
pnotarisations->WriteBatch(batch, true);
|
pnotarizations->WriteBatch(batch, true);
|
||||||
LogPrintf("DisconnectTip: deleted %i block notarizations in block: %s\n",
|
LogPrintf("DisconnectTip: deleted %i block notarizations in block: %s\n",
|
||||||
nibs.size(), block.GetHash().GetHex().data());
|
nibs.size(), block.GetHash().GetHex().data());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
NotarizationDB *pnotarisations;
|
NotarizationDB *pnotarizations;
|
||||||
NotarizationDB::NotarizationDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "notarizations", nCacheSize, fMemory, fWipe, false, 64) { }
|
NotarizationDB::NotarizationDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "notarizations", nCacheSize, fMemory, fWipe, false, 64) { }
|
||||||
|
|
||||||
NotarisationsInBlock ScanBlockNotarizations(const CBlock &block, int nHeight)
|
NotarisationsInBlock ScanBlockNotarizations(const CBlock &block, int nHeight)
|
||||||
@@ -55,13 +55,13 @@ NotarisationsInBlock ScanBlockNotarizations(const CBlock &block, int nHeight)
|
|||||||
|
|
||||||
bool GetBlockNotarisations(uint256 blockHash, NotarisationsInBlock &nibs)
|
bool GetBlockNotarisations(uint256 blockHash, NotarisationsInBlock &nibs)
|
||||||
{
|
{
|
||||||
return pnotarisations->Read(blockHash, nibs);
|
return pnotarizations->Read(blockHash, nibs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GetBackNotarisation(uint256 notarisationHash, Notarisation &n)
|
bool GetBackNotarisation(uint256 notarisationHash, Notarisation &n)
|
||||||
{
|
{
|
||||||
return pnotarisations->Read(notarisationHash, n);
|
return pnotarizations->Read(notarisationHash, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
#include "dbwrapper.h"
|
#include "dbwrapper.h"
|
||||||
#include "cc/eval.h"
|
#include "cc/eval.h"
|
||||||
|
|
||||||
class NotarisationDB : public CDBWrapper
|
class NotarizationDB : public CDBWrapper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NotarisationDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
|
NotarizationDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern NotarisationDB *pnotarisations;
|
extern NotarizationDB *pnotarizations;
|
||||||
typedef std::pair<uint256,NotarisationData> Notarisation;
|
typedef std::pair<uint256,NotarisationData> Notarisation;
|
||||||
typedef std::vector<Notarisation> NotarisationsInBlock;
|
typedef std::vector<Notarisation> NotarisationsInBlock;
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ void setupChain() {
|
|||||||
pblocktree = new CBlockTreeDB(1 << 20, true);
|
pblocktree = new CBlockTreeDB(1 << 20, true);
|
||||||
CCoinsViewDB *pcoinsdbview = new CCoinsViewDB(1 << 23, true);
|
CCoinsViewDB *pcoinsdbview = new CCoinsViewDB(1 << 23, true);
|
||||||
pcoinsTip = new CCoinsViewCache(pcoinsdbview);
|
pcoinsTip = new CCoinsViewCache(pcoinsdbview);
|
||||||
pnotarisations = new NotarizationDB(1 << 20, true);
|
pnotarizations = new NotarizationDB(1 << 20, true);
|
||||||
InitBlockIndex();
|
InitBlockIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user