log notarisations written to index

This commit is contained in:
Scott Sadler
2018-06-11 17:29:16 +02:00
parent 89cfc4272d
commit 846384769c
3 changed files with 26 additions and 19 deletions

View File

@@ -61,25 +61,24 @@ bool GetBackNotarisation(uint256 notarisationHash, Notarisation &n)
/*
* Write an index of KMD notarisation id -> backnotarisation
*/
void WriteBackNotarisations(const NotarisationsInBlock notarisations)
void WriteBackNotarisations(const NotarisationsInBlock notarisations, CLevelDBBatch &batch)
{
CLevelDBBatch batch;
int wrote = 0;
BOOST_FOREACH(const Notarisation &n, notarisations)
{
if (!n.second.txHash.IsNull())
if (!n.second.txHash.IsNull()) {
batch.Write(n.second.txHash, n);
wrote++;
}
}
pnotarisations->WriteBatch(batch, true);
}
void EraseBackNotarisations(const NotarisationsInBlock notarisations)
void EraseBackNotarisations(const NotarisationsInBlock notarisations, CLevelDBBatch &batch)
{
CLevelDBBatch batch;
BOOST_FOREACH(const Notarisation &n, notarisations)
{
if (!n.second.txHash.IsNull())
batch.Erase(n.second.txHash);
}
pnotarisations->WriteBatch(batch, true);
}