Skip to content

Commit 529ff1f

Browse files
committed
[Refactoring] Stop writing zerocoin mints in the DB
1 parent 6b51e1c commit 529ff1f

File tree

3 files changed

+0
-33
lines changed

3 files changed

+0
-33
lines changed

src/txdb.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -361,21 +361,6 @@ CZerocoinDB::CZerocoinDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapp
361361
{
362362
}
363363

364-
bool CZerocoinDB::WriteCoinMintBatch(const std::vector<std::pair<libzerocoin::PublicCoin, uint256> >& mintInfo)
365-
{
366-
CDBBatch batch;
367-
size_t count = 0;
368-
for (std::vector<std::pair<libzerocoin::PublicCoin, uint256> >::const_iterator it=mintInfo.begin(); it != mintInfo.end(); it++) {
369-
libzerocoin::PublicCoin pubCoin = it->first;
370-
uint256 hash = GetPubCoinHash(pubCoin.getValue());
371-
batch.Write(std::make_pair('m', hash), it->second);
372-
++count;
373-
}
374-
375-
LogPrint(BCLog::COINDB, "Writing %u coin mints to db.\n", (unsigned int)count);
376-
return WriteBatch(batch, true);
377-
}
378-
379364
bool CZerocoinDB::WriteCoinSpendBatch(const std::vector<std::pair<libzerocoin::CoinSpend, uint256> >& spendInfo)
380365
{
381366
CDBBatch batch;

src/txdb.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ class CZerocoinDB : public CDBWrapper
156156
void operator=(const CZerocoinDB&);
157157

158158
public:
159-
/** Write zPIV mints to the zerocoinDB in a batch */
160-
bool WriteCoinMintBatch(const std::vector<std::pair<libzerocoin::PublicCoin, uint256> >& mintInfo);
161159
/** Write zPIV spends to the zerocoinDB in a batch */
162160
bool WriteCoinSpendBatch(const std::vector<std::pair<libzerocoin::CoinSpend, uint256> >& spendInfo);
163161
bool ReadCoinSpend(const CBigNum& bnSerial, uint256& txHash);

src/validation.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,6 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd
15401540
CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(block.vtx.size()));
15411541
std::vector<std::pair<uint256, CDiskTxPos> > vPos;
15421542
std::vector<std::pair<libzerocoin::CoinSpend, uint256> > vSpends;
1543-
std::vector<std::pair<libzerocoin::PublicCoin, uint256> > vMints;
15441543
vPos.reserve(block.vtx.size());
15451544
CBlockUndo blockundo;
15461545
blockundo.vtxundo.reserve(block.vtx.size() - 1);
@@ -1583,19 +1582,6 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd
15831582
return state.DoS(100, error("%s : v5 upgrade enforced, zerocoin disabled", __func__));
15841583
}
15851584

1586-
if (tx.HasZerocoinMintOutputs()) {
1587-
if (consensus.NetworkUpgradeActive(pindex->nHeight, Consensus::UPGRADE_ZC_PUBLIC))
1588-
return state.DoS(100, error("%s: Mints no longer accepted at height %d", __func__, pindex->nHeight));
1589-
// parse minted coins
1590-
for (auto& out : tx.vout) {
1591-
if (!out.IsZerocoinMint()) continue;
1592-
libzerocoin::PublicCoin coin(consensus.Zerocoin_Params(false));
1593-
if (!TxOutToPublicCoin(out, coin, state))
1594-
return state.DoS(100, error("%s: failed final check of zerocoinmint for tx %s", __func__, tx.GetHash().GetHex()));
1595-
vMints.emplace_back(coin, tx.GetHash());
1596-
}
1597-
}
1598-
15991585
if (tx.HasZerocoinSpendInputs()) {
16001586
int nHeightTx = 0;
16011587
uint256 txid = tx.GetHash();
@@ -1770,8 +1756,6 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd
17701756
// Flush spend/mint info to disk
17711757
if (!vSpends.empty() && !zerocoinDB->WriteCoinSpendBatch(vSpends))
17721758
return AbortNode(state, "Failed to record coin serials to database");
1773-
if (!vMints.empty() && !zerocoinDB->WriteCoinMintBatch(vMints))
1774-
return AbortNode(state, "Failed to record new mints to database");
17751759

17761760
if (fTxIndex)
17771761
if (!pblocktree->WriteTxIndex(vPos))

0 commit comments

Comments
 (0)