Skip to content

Commit 547ca6c

Browse files
barrystyleFuzzbawls
authored andcommitted
Move all zerocoin-related checks/functions to the consensus folder.
1 parent 041c9ee commit 547ca6c

13 files changed

+579
-538
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ set(COMMON_SOURCES
456456
./src/compressor.cpp
457457
./src/consensus/merkle.cpp
458458
./src/consensus/tx_verify.cpp
459+
./src/consensus/zerocoin_verify.cpp
459460
./src/primitives/block.cpp
460461
./src/zpiv/deterministicmint.cpp
461462
./src/primitives/transaction.cpp

src/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ BITCOIN_CORE_H = \
102102
consensus/consensus.h \
103103
consensus/merkle.h \
104104
consensus/tx_verify.h \
105+
consensus/zerocoin_verify.h \
105106
consensus/validation.h \
106107
primitives/block.h \
107108
primitives/transaction.h \
@@ -216,6 +217,7 @@ libbitcoin_server_a_SOURCES = \
216217
chain.cpp \
217218
checkpoints.cpp \
218219
consensus/tx_verify.cpp \
220+
consensus/zerocoin_verify.cpp \
219221
httprpc.cpp \
220222
httpserver.cpp \
221223
init.cpp \

src/consensus/tx_verify.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "tx_verify.h"
66

77
#include "consensus/consensus.h"
8+
#include "consensus/zerocoin_verify.h"
89
#include "main.h"
910
#include "script/interpreter.h"
1011

src/consensus/zerocoin_verify.cpp

Lines changed: 537 additions & 0 deletions
Large diffs are not rendered by default.

src/consensus/zerocoin_verify.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) 2017-2017 The Bitcoin Core developers
2+
// Copyright (c) 2015-2019 The PIVX developers
3+
// Distributed under the MIT software license, see the accompanying
4+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
6+
#include "consensus/consensus.h"
7+
#include "main.h"
8+
#include "script/interpreter.h"
9+
#include "zpivchain.h"
10+
11+
class CZerocoinDB;
12+
13+
//! zerocoin or related verification/tests
14+
bool CheckZerocoinMint(const uint256& txHash, const CTxOut& txout, CValidationState& state, bool fCheckOnly = false);
15+
bool ContextualCheckZerocoinMint(const CTransaction& tx, const libzerocoin::PublicCoin& coin, const CBlockIndex* pindex); // note this function is local only to main.cpp
16+
bool ContextualCheckZerocoinSpend(const CTransaction& tx, const libzerocoin::CoinSpend* spend, CBlockIndex* pindex, const uint256& hashBlock);
17+
bool ContextualCheckZerocoinSpendNoSerialCheck(const CTransaction& tx, const libzerocoin::CoinSpend* spend, CBlockIndex* pindex, const uint256& hashblock);
18+
bool CheckZerocoinSpend(const CTransaction& tx, bool fVerifySignature, CValidationState& state, bool fFakeSerialAttack = false);
19+
bool isBlockBetweenFakeSerialAttackRange(int nHeight);
20+
bool CheckPublicCoinSpendEnforced(int blockHeight, bool isPublicSpend);
21+
bool CheckPublicCoinSpendVersion(int version);
22+
int CurrentPublicCoinSpendVersion();
23+
void AddWrappedSerialsInflation();
24+
void RecalculateZPIVMinted();
25+
void RecalculateZPIVSpent();
26+
bool RecalculatePIVSupply(int nHeightStart);
27+
bool ReindexAccumulators(std::list<uint256>& listMissingCheckpoints, std::string& strError);
28+
bool UpdateZPIVSupply(const CBlock& block, CBlockIndex* pindex, bool fJustCheck);

src/init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "amount.h"
2121
#include "checkpoints.h"
2222
#include "compat/sanity.h"
23+
#include "consensus/zerocoin_verify.h"
2324
#include "httpserver.h"
2425
#include "httprpc.h"
2526
#include "invalid.h"

0 commit comments

Comments
 (0)