diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 705da8e5f..f9d9d7510 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -10,15 +10,19 @@ #include NotarisationDB *pnotarisations; - -NotarisationDB::NotarisationDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "notarisations", nCacheSize, fMemory, fWipe, false, 64) { } - +NotarisationDB::NotarisationDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "notarizations", nCacheSize, fMemory, fWipe, false, 64) { } NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) { EvalRef eval; NotarisationsInBlock vNotarisations; int timestamp = block.nTime; + bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false; + + // No valid ntz's before this height + if(ishush3 && (nHeight <= 340420)) { + return vNotarisations; + } for (unsigned int i = 0; i < block.vtx.size(); i++) { CTransaction tx = block.vtx[i]; @@ -44,18 +48,11 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) // data.symbol, tx.GetHash().GetHex().data(), data.ccId, data.MoMDepth); //if (!data.MoMoM.IsNull()) printf("MoMoM:%s\n", data.MoMoM.GetHex().data()); } else - LogPrintf("WARNING: Couldn't parse notarisation for tx: %s at height %i\n", - tx.GetHash().GetHex().data(), nHeight); + LogPrintf("WARNING: Couldn't parse notarisation for tx: %s at height %i\n", tx.GetHash().GetHex().data(), nHeight); } return vNotarisations; } -bool IsTXSCL(const char* symbol) -{ - return strlen(symbol) >= 5 && strncmp(symbol, "TXSCL", 5) == 0; -} - - bool GetBlockNotarisations(uint256 blockHash, NotarisationsInBlock &nibs) { return pnotarisations->Read(blockHash, nibs); @@ -69,7 +66,7 @@ bool GetBackNotarisation(uint256 notarisationHash, Notarisation &n) /* - * Write an index of KMD notarisation id -> backnotarisation + * Write an index of HUSH notarisation id -> backnotarisation */ void WriteBackNotarisations(const NotarisationsInBlock notarisations, CDBBatch &batch) { diff --git a/src/notarisationdb.h b/src/notarisationdb.h index af5d4df28..edd483639 100644 --- a/src/notarisationdb.h +++ b/src/notarisationdb.h @@ -1,20 +1,20 @@ -#ifndef NOTARISATIONDB_H -#define NOTARISATIONDB_H +// Copyright (c) 2019-2020 The Hush developers +// Distributed under the GPLv3 software license, see the accompanying +// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html +#ifndef HUSH_NOTARISATIONDB_H +#define HUSH_NOTARISATIONDB_H #include "uint256.h" #include "dbwrapper.h" #include "cc/eval.h" - class NotarisationDB : public CDBWrapper { public: NotarisationDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false); }; - extern NotarisationDB *pnotarisations; - typedef std::pair Notarisation; typedef std::vector NotarisationsInBlock; @@ -25,6 +25,5 @@ void WriteBackNotarisations(const NotarisationsInBlock notarisations, CDBBatch & void EraseBackNotarisations(const NotarisationsInBlock notarisations, CDBBatch &batch); int ScanNotarisationsDB(int height, std::string symbol, int scanLimitBlocks, Notarisation& out); int ScanNotarisationsDB2(int height, std::string symbol, int scanLimitBlocks, Notarisation& out); -bool IsTXSCL(const char* symbol); -#endif /* NOTARISATIONDB_H */ +#endif /* HUSH_NOTARISATIONDB_H */