Rename CPourTx to JSDescription.

This commit is contained in:
Sean Bowe
2016-07-10 23:02:10 -06:00
parent f30580744f
commit a8c68ffe99
14 changed files with 66 additions and 66 deletions

View File

@@ -394,7 +394,7 @@ bool CCoinsViewCache::HavePourRequirements(const CTransaction& tx) const
{ {
boost::unordered_map<uint256, ZCIncrementalMerkleTree, CCoinsKeyHasher> intermediates; boost::unordered_map<uint256, ZCIncrementalMerkleTree, CCoinsKeyHasher> intermediates;
BOOST_FOREACH(const CPourTx &pour, tx.vpour) BOOST_FOREACH(const JSDescription &pour, tx.vpour)
{ {
BOOST_FOREACH(const uint256& serial, pour.serials) BOOST_FOREACH(const uint256& serial, pour.serials)
{ {

View File

@@ -15,9 +15,9 @@ TEST(checktransaction_tests, check_vpub_not_both_nonzero) {
CMutableTransaction newTx(tx); CMutableTransaction newTx(tx);
CValidationState state; CValidationState state;
newTx.vpour.push_back(CPourTx()); newTx.vpour.push_back(JSDescription());
CPourTx *pourtx = &newTx.vpour[0]; JSDescription *pourtx = &newTx.vpour[0];
pourtx->vpub_old = 1; pourtx->vpub_old = 1;
pourtx->vpub_new = 1; pourtx->vpub_new = 1;

View File

@@ -876,7 +876,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
return false; return false;
} else { } else {
// Ensure that zk-SNARKs verify // Ensure that zk-SNARKs verify
BOOST_FOREACH(const CPourTx &pour, tx.vpour) { BOOST_FOREACH(const JSDescription &pour, tx.vpour) {
if (!pour.Verify(*pzcashParams, tx.joinSplitPubKey)) { if (!pour.Verify(*pzcashParams, tx.joinSplitPubKey)) {
return state.DoS(100, error("CheckTransaction(): pour does not verify"), return state.DoS(100, error("CheckTransaction(): pour does not verify"),
REJECT_INVALID, "bad-txns-pour-verification-failed"); REJECT_INVALID, "bad-txns-pour-verification-failed");
@@ -921,7 +921,7 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio
} }
// Ensure that pour values are well-formed // Ensure that pour values are well-formed
BOOST_FOREACH(const CPourTx& pour, tx.vpour) BOOST_FOREACH(const JSDescription& pour, tx.vpour)
{ {
if (pour.vpub_old < 0) { if (pour.vpub_old < 0) {
return state.DoS(100, error("CheckTransaction(): pour.vpub_old negative"), return state.DoS(100, error("CheckTransaction(): pour.vpub_old negative"),
@@ -968,7 +968,7 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio
// Check for duplicate pour serials in this transaction // Check for duplicate pour serials in this transaction
set<uint256> vPourSerials; set<uint256> vPourSerials;
BOOST_FOREACH(const CPourTx& pour, tx.vpour) BOOST_FOREACH(const JSDescription& pour, tx.vpour)
{ {
BOOST_FOREACH(const uint256& serial, pour.serials) BOOST_FOREACH(const uint256& serial, pour.serials)
{ {
@@ -1104,7 +1104,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
return false; return false;
} }
} }
BOOST_FOREACH(const CPourTx &pour, tx.vpour) { BOOST_FOREACH(const JSDescription &pour, tx.vpour) {
BOOST_FOREACH(const uint256 &serial, pour.serials) { BOOST_FOREACH(const uint256 &serial, pour.serials) {
if (pool.mapSerials.count(serial)) if (pool.mapSerials.count(serial))
{ {
@@ -1586,7 +1586,7 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach
} }
// spend serials // spend serials
BOOST_FOREACH(const CPourTx &pour, tx.vpour) { BOOST_FOREACH(const JSDescription &pour, tx.vpour) {
BOOST_FOREACH(const uint256 &serial, pour.serials) { BOOST_FOREACH(const uint256 &serial, pour.serials) {
inputs.SetSerial(serial, true); inputs.SetSerial(serial, true);
} }
@@ -1908,7 +1908,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
} }
// unspend serials // unspend serials
BOOST_FOREACH(const CPourTx &pour, tx.vpour) { BOOST_FOREACH(const JSDescription &pour, tx.vpour) {
BOOST_FOREACH(const uint256 &serial, pour.serials) { BOOST_FOREACH(const uint256 &serial, pour.serials) {
view.SetSerial(serial, false); view.SetSerial(serial, false);
} }
@@ -2157,7 +2157,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
} }
UpdateCoins(tx, state, view, i == 0 ? undoDummy : blockundo.vtxundo.back(), pindex->nHeight); UpdateCoins(tx, state, view, i == 0 ? undoDummy : blockundo.vtxundo.back(), pindex->nHeight);
BOOST_FOREACH(const CPourTx &pour, tx.vpour) { BOOST_FOREACH(const JSDescription &pour, tx.vpour) {
BOOST_FOREACH(const uint256 &bucket_commitment, pour.commitments) { BOOST_FOREACH(const uint256 &bucket_commitment, pour.commitments) {
// Insert the bucket commitments into our temporary tree. // Insert the bucket commitments into our temporary tree.

View File

@@ -9,7 +9,7 @@
#include "tinyformat.h" #include "tinyformat.h"
#include "utilstrencodings.h" #include "utilstrencodings.h"
CPourTx::CPourTx(ZCJoinSplit& params, JSDescription::JSDescription(ZCJoinSplit& params,
const uint256& pubKeyHash, const uint256& pubKeyHash,
const uint256& anchor, const uint256& anchor,
const boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs, const boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs,
@@ -37,7 +37,7 @@ CPourTx::CPourTx(ZCJoinSplit& params,
); );
} }
bool CPourTx::Verify( bool JSDescription::Verify(
ZCJoinSplit& params, ZCJoinSplit& params,
const uint256& pubKeyHash const uint256& pubKeyHash
) const { ) const {
@@ -54,7 +54,7 @@ bool CPourTx::Verify(
); );
} }
uint256 CPourTx::h_sig(ZCJoinSplit& params, const uint256& pubKeyHash) const uint256 JSDescription::h_sig(ZCJoinSplit& params, const uint256& pubKeyHash) const
{ {
return params.h_sig(randomSeed, serials, pubKeyHash); return params.h_sig(randomSeed, serials, pubKeyHash);
} }
@@ -139,7 +139,7 @@ CTransaction& CTransaction::operator=(const CTransaction &tx) {
*const_cast<std::vector<CTxIn>*>(&vin) = tx.vin; *const_cast<std::vector<CTxIn>*>(&vin) = tx.vin;
*const_cast<std::vector<CTxOut>*>(&vout) = tx.vout; *const_cast<std::vector<CTxOut>*>(&vout) = tx.vout;
*const_cast<unsigned int*>(&nLockTime) = tx.nLockTime; *const_cast<unsigned int*>(&nLockTime) = tx.nLockTime;
*const_cast<std::vector<CPourTx>*>(&vpour) = tx.vpour; *const_cast<std::vector<JSDescription>*>(&vpour) = tx.vpour;
*const_cast<uint256*>(&joinSplitPubKey) = tx.joinSplitPubKey; *const_cast<uint256*>(&joinSplitPubKey) = tx.joinSplitPubKey;
*const_cast<joinsplit_sig_t*>(&joinSplitSig) = tx.joinSplitSig; *const_cast<joinsplit_sig_t*>(&joinSplitSig) = tx.joinSplitSig;
*const_cast<uint256*>(&hash) = tx.hash; *const_cast<uint256*>(&hash) = tx.hash;
@@ -156,7 +156,7 @@ CAmount CTransaction::GetValueOut() const
throw std::runtime_error("CTransaction::GetValueOut(): value out of range"); throw std::runtime_error("CTransaction::GetValueOut(): value out of range");
} }
for (std::vector<CPourTx>::const_iterator it(vpour.begin()); it != vpour.end(); ++it) for (std::vector<JSDescription>::const_iterator it(vpour.begin()); it != vpour.end(); ++it)
{ {
// NB: vpub_old "takes" money from the value pool just as outputs do // NB: vpub_old "takes" money from the value pool just as outputs do
nValueOut += it->vpub_old; nValueOut += it->vpub_old;
@@ -170,7 +170,7 @@ CAmount CTransaction::GetValueOut() const
CAmount CTransaction::GetPourValueIn() const CAmount CTransaction::GetPourValueIn() const
{ {
CAmount nValue = 0; CAmount nValue = 0;
for (std::vector<CPourTx>::const_iterator it(vpour.begin()); it != vpour.end(); ++it) for (std::vector<JSDescription>::const_iterator it(vpour.begin()); it != vpour.end(); ++it)
{ {
// NB: vpub_new "gives" money to the value pool just as inputs do // NB: vpub_new "gives" money to the value pool just as inputs do
nValue += it->vpub_new; nValue += it->vpub_new;

View File

@@ -17,7 +17,7 @@
#include "zcash/Zcash.h" #include "zcash/Zcash.h"
#include "zcash/JoinSplit.hpp" #include "zcash/JoinSplit.hpp"
class CPourTx class JSDescription
{ {
public: public:
// These values 'enter from' and 'exit to' the value // These values 'enter from' and 'exit to' the value
@@ -65,9 +65,9 @@ public:
// This is a zk-SNARK which ensures that this pour is valid. // This is a zk-SNARK which ensures that this pour is valid.
boost::array<unsigned char, ZKSNARK_PROOF_SIZE> proof; boost::array<unsigned char, ZKSNARK_PROOF_SIZE> proof;
CPourTx(): vpub_old(0), vpub_new(0) { } JSDescription(): vpub_old(0), vpub_new(0) { }
CPourTx(ZCJoinSplit& params, JSDescription(ZCJoinSplit& params,
const uint256& pubKeyHash, const uint256& pubKeyHash,
const uint256& rt, const uint256& rt,
const boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs, const boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs,
@@ -98,7 +98,7 @@ public:
READWRITE(proof); READWRITE(proof);
} }
friend bool operator==(const CPourTx& a, const CPourTx& b) friend bool operator==(const JSDescription& a, const JSDescription& b)
{ {
return ( return (
a.vpub_old == b.vpub_old && a.vpub_old == b.vpub_old &&
@@ -114,7 +114,7 @@ public:
); );
} }
friend bool operator!=(const CPourTx& a, const CPourTx& b) friend bool operator!=(const JSDescription& a, const JSDescription& b)
{ {
return !(a == b); return !(a == b);
} }
@@ -303,7 +303,7 @@ public:
const std::vector<CTxIn> vin; const std::vector<CTxIn> vin;
const std::vector<CTxOut> vout; const std::vector<CTxOut> vout;
const uint32_t nLockTime; const uint32_t nLockTime;
const std::vector<CPourTx> vpour; const std::vector<JSDescription> vpour;
const uint256 joinSplitPubKey; const uint256 joinSplitPubKey;
const joinsplit_sig_t joinSplitSig; const joinsplit_sig_t joinSplitSig;
@@ -325,7 +325,7 @@ public:
READWRITE(*const_cast<std::vector<CTxOut>*>(&vout)); READWRITE(*const_cast<std::vector<CTxOut>*>(&vout));
READWRITE(*const_cast<uint32_t*>(&nLockTime)); READWRITE(*const_cast<uint32_t*>(&nLockTime));
if (nVersion >= 2) { if (nVersion >= 2) {
READWRITE(*const_cast<std::vector<CPourTx>*>(&vpour)); READWRITE(*const_cast<std::vector<JSDescription>*>(&vpour));
if (vpour.size() > 0) { if (vpour.size() > 0) {
READWRITE(*const_cast<uint256*>(&joinSplitPubKey)); READWRITE(*const_cast<uint256*>(&joinSplitPubKey));
READWRITE(*const_cast<joinsplit_sig_t*>(&joinSplitSig)); READWRITE(*const_cast<joinsplit_sig_t*>(&joinSplitSig));
@@ -382,7 +382,7 @@ struct CMutableTransaction
std::vector<CTxIn> vin; std::vector<CTxIn> vin;
std::vector<CTxOut> vout; std::vector<CTxOut> vout;
uint32_t nLockTime; uint32_t nLockTime;
std::vector<CPourTx> vpour; std::vector<JSDescription> vpour;
uint256 joinSplitPubKey; uint256 joinSplitPubKey;
CTransaction::joinsplit_sig_t joinSplitSig; CTransaction::joinsplit_sig_t joinSplitSig;

View File

@@ -92,7 +92,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
Array vpour; Array vpour;
for (unsigned int i = 0; i < tx.vpour.size(); i++) { for (unsigned int i = 0; i < tx.vpour.size(); i++) {
const CPourTx& pourtx = tx.vpour[i]; const JSDescription& pourtx = tx.vpour[i];
Object pour; Object pour;
pour.push_back(Pair("anchor", pourtx.anchor.GetHex())); pour.push_back(Pair("anchor", pourtx.anchor.GetHex()));

View File

@@ -224,7 +224,7 @@ BOOST_AUTO_TEST_CASE(chained_pours)
ZCIncrementalMerkleTree tree; ZCIncrementalMerkleTree tree;
CPourTx ptx1; JSDescription ptx1;
ptx1.anchor = tree.root(); ptx1.anchor = tree.root();
ptx1.commitments[0] = appendRandomCommitment(tree); ptx1.commitments[0] = appendRandomCommitment(tree);
ptx1.commitments[1] = appendRandomCommitment(tree); ptx1.commitments[1] = appendRandomCommitment(tree);
@@ -232,13 +232,13 @@ BOOST_AUTO_TEST_CASE(chained_pours)
// Although it's not possible given our assumptions, if // Although it's not possible given our assumptions, if
// two pours create the same treestate twice, we should // two pours create the same treestate twice, we should
// still be able to anchor to it. // still be able to anchor to it.
CPourTx ptx1b; JSDescription ptx1b;
ptx1b.anchor = tree.root(); ptx1b.anchor = tree.root();
ptx1b.commitments[0] = ptx1.commitments[0]; ptx1b.commitments[0] = ptx1.commitments[0];
ptx1b.commitments[1] = ptx1.commitments[1]; ptx1b.commitments[1] = ptx1.commitments[1];
CPourTx ptx2; JSDescription ptx2;
CPourTx ptx3; JSDescription ptx3;
ptx2.anchor = tree.root(); ptx2.anchor = tree.root();
ptx3.anchor = tree.root(); ptx3.anchor = tree.root();

View File

@@ -122,7 +122,7 @@ void static RandomTransaction(CMutableTransaction &tx, bool fSingle) {
} }
if (tx.nVersion >= 2) { if (tx.nVersion >= 2) {
for (int pour = 0; pour < pours; pour++) { for (int pour = 0; pour < pours; pour++) {
CPourTx pourtx; JSDescription pourtx;
if (insecure_rand() % 2 == 0) { if (insecure_rand() % 2 == 0) {
pourtx.vpub_old = insecure_rand() % 100000000; pourtx.vpub_old = insecure_rand() % 100000000;
} else { } else {

View File

@@ -330,7 +330,7 @@ BOOST_AUTO_TEST_CASE(test_basic_pour_verification)
auto witness = merkleTree.witness(); auto witness = merkleTree.witness();
// create CPourTx // create JSDescription
uint256 pubKeyHash; uint256 pubKeyHash;
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs = { boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs = {
libzcash::JSInput(witness, note, k), libzcash::JSInput(witness, note, k),
@@ -342,13 +342,13 @@ BOOST_AUTO_TEST_CASE(test_basic_pour_verification)
}; };
{ {
CPourTx pourtx(*p, pubKeyHash, rt, inputs, outputs, 0, 0); JSDescription pourtx(*p, pubKeyHash, rt, inputs, outputs, 0, 0);
BOOST_CHECK(pourtx.Verify(*p, pubKeyHash)); BOOST_CHECK(pourtx.Verify(*p, pubKeyHash));
CDataStream ss(SER_DISK, CLIENT_VERSION); CDataStream ss(SER_DISK, CLIENT_VERSION);
ss << pourtx; ss << pourtx;
CPourTx pourtx_deserialized; JSDescription pourtx_deserialized;
ss >> pourtx_deserialized; ss >> pourtx_deserialized;
BOOST_CHECK(pourtx_deserialized == pourtx); BOOST_CHECK(pourtx_deserialized == pourtx);
@@ -357,13 +357,13 @@ BOOST_AUTO_TEST_CASE(test_basic_pour_verification)
{ {
// Ensure that the balance equation is working. // Ensure that the balance equation is working.
BOOST_CHECK_THROW(CPourTx(*p, pubKeyHash, rt, inputs, outputs, 10, 0), std::invalid_argument); BOOST_CHECK_THROW(JSDescription(*p, pubKeyHash, rt, inputs, outputs, 10, 0), std::invalid_argument);
BOOST_CHECK_THROW(CPourTx(*p, pubKeyHash, rt, inputs, outputs, 0, 10), std::invalid_argument); BOOST_CHECK_THROW(JSDescription(*p, pubKeyHash, rt, inputs, outputs, 0, 10), std::invalid_argument);
} }
{ {
// Ensure that it won't verify if the root is changed. // Ensure that it won't verify if the root is changed.
auto test = CPourTx(*p, pubKeyHash, rt, inputs, outputs, 0, 0); auto test = JSDescription(*p, pubKeyHash, rt, inputs, outputs, 0, 0);
test.anchor = GetRandHash(); test.anchor = GetRandHash();
BOOST_CHECK(!test.Verify(*p, pubKeyHash)); BOOST_CHECK(!test.Verify(*p, pubKeyHash));
} }
@@ -393,8 +393,8 @@ BOOST_AUTO_TEST_CASE(test_simple_pour_invalidity)
BOOST_CHECK(!CheckTransactionWithoutProofVerification(newTx, state)); BOOST_CHECK(!CheckTransactionWithoutProofVerification(newTx, state));
BOOST_CHECK(state.GetRejectReason() == "bad-txns-vout-empty"); BOOST_CHECK(state.GetRejectReason() == "bad-txns-vout-empty");
newTx.vpour.push_back(CPourTx()); newTx.vpour.push_back(JSDescription());
CPourTx *pourtx = &newTx.vpour[0]; JSDescription *pourtx = &newTx.vpour[0];
pourtx->serials[0] = GetRandHash(); pourtx->serials[0] = GetRandHash();
pourtx->serials[1] = GetRandHash(); pourtx->serials[1] = GetRandHash();
@@ -422,9 +422,9 @@ BOOST_AUTO_TEST_CASE(test_simple_pour_invalidity)
CMutableTransaction newTx(tx); CMutableTransaction newTx(tx);
CValidationState state; CValidationState state;
newTx.vpour.push_back(CPourTx()); newTx.vpour.push_back(JSDescription());
CPourTx *pourtx = &newTx.vpour[0]; JSDescription *pourtx = &newTx.vpour[0];
pourtx->vpub_old = -1; pourtx->vpub_old = -1;
BOOST_CHECK(!CheckTransaction(newTx, state)); BOOST_CHECK(!CheckTransaction(newTx, state));
@@ -448,9 +448,9 @@ BOOST_AUTO_TEST_CASE(test_simple_pour_invalidity)
pourtx->vpub_new = (MAX_MONEY / 2) + 10; pourtx->vpub_new = (MAX_MONEY / 2) + 10;
newTx.vpour.push_back(CPourTx()); newTx.vpour.push_back(JSDescription());
CPourTx *pourtx2 = &newTx.vpour[1]; JSDescription *pourtx2 = &newTx.vpour[1];
pourtx2->vpub_new = (MAX_MONEY / 2) + 10; pourtx2->vpub_new = (MAX_MONEY / 2) + 10;
BOOST_CHECK(!CheckTransaction(newTx, state)); BOOST_CHECK(!CheckTransaction(newTx, state));
@@ -461,8 +461,8 @@ BOOST_AUTO_TEST_CASE(test_simple_pour_invalidity)
CMutableTransaction newTx(tx); CMutableTransaction newTx(tx);
CValidationState state; CValidationState state;
newTx.vpour.push_back(CPourTx()); newTx.vpour.push_back(JSDescription());
CPourTx *pourtx = &newTx.vpour[0]; JSDescription *pourtx = &newTx.vpour[0];
pourtx->serials[0] = GetRandHash(); pourtx->serials[0] = GetRandHash();
pourtx->serials[1] = pourtx->serials[0]; pourtx->serials[1] = pourtx->serials[0];
@@ -472,8 +472,8 @@ BOOST_AUTO_TEST_CASE(test_simple_pour_invalidity)
pourtx->serials[1] = GetRandHash(); pourtx->serials[1] = GetRandHash();
newTx.vpour.push_back(CPourTx()); newTx.vpour.push_back(JSDescription());
CPourTx *pourtx2 = &newTx.vpour[1]; JSDescription *pourtx2 = &newTx.vpour[1];
pourtx2->serials[0] = GetRandHash(); pourtx2->serials[0] = GetRandHash();
pourtx2->serials[1] = pourtx->serials[0]; pourtx2->serials[1] = pourtx->serials[0];
@@ -486,8 +486,8 @@ BOOST_AUTO_TEST_CASE(test_simple_pour_invalidity)
CMutableTransaction newTx(tx); CMutableTransaction newTx(tx);
CValidationState state; CValidationState state;
newTx.vpour.push_back(CPourTx()); newTx.vpour.push_back(JSDescription());
CPourTx *pourtx = &newTx.vpour[0]; JSDescription *pourtx = &newTx.vpour[0];
pourtx->serials[0] = GetRandHash(); pourtx->serials[0] = GetRandHash();
pourtx->serials[1] = GetRandHash(); pourtx->serials[1] = GetRandHash();

View File

@@ -99,7 +99,7 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry,
const CTransaction& tx = mapTx[hash].GetTx(); const CTransaction& tx = mapTx[hash].GetTx();
for (unsigned int i = 0; i < tx.vin.size(); i++) for (unsigned int i = 0; i < tx.vin.size(); i++)
mapNextTx[tx.vin[i].prevout] = CInPoint(&tx, i); mapNextTx[tx.vin[i].prevout] = CInPoint(&tx, i);
BOOST_FOREACH(const CPourTx &pour, tx.vpour) { BOOST_FOREACH(const JSDescription &pour, tx.vpour) {
BOOST_FOREACH(const uint256 &serial, pour.serials) { BOOST_FOREACH(const uint256 &serial, pour.serials) {
mapSerials[serial] = &tx; mapSerials[serial] = &tx;
} }
@@ -148,7 +148,7 @@ void CTxMemPool::remove(const CTransaction &origTx, std::list<CTransaction>& rem
} }
BOOST_FOREACH(const CTxIn& txin, tx.vin) BOOST_FOREACH(const CTxIn& txin, tx.vin)
mapNextTx.erase(txin.prevout); mapNextTx.erase(txin.prevout);
BOOST_FOREACH(const CPourTx& pour, tx.vpour) { BOOST_FOREACH(const JSDescription& pour, tx.vpour) {
BOOST_FOREACH(const uint256& serial, pour.serials) { BOOST_FOREACH(const uint256& serial, pour.serials) {
mapSerials.erase(serial); mapSerials.erase(serial);
} }
@@ -200,7 +200,7 @@ void CTxMemPool::removeWithAnchor(const uint256 &invalidRoot)
for (std::map<uint256, CTxMemPoolEntry>::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) { for (std::map<uint256, CTxMemPoolEntry>::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) {
const CTransaction& tx = it->second.GetTx(); const CTransaction& tx = it->second.GetTx();
BOOST_FOREACH(const CPourTx& pour, tx.vpour) { BOOST_FOREACH(const JSDescription& pour, tx.vpour) {
if (pour.anchor == invalidRoot) { if (pour.anchor == invalidRoot) {
transactionsToRemove.push_back(tx); transactionsToRemove.push_back(tx);
break; break;
@@ -230,7 +230,7 @@ void CTxMemPool::removeConflicts(const CTransaction &tx, std::list<CTransaction>
} }
} }
BOOST_FOREACH(const CPourTx &pour, tx.vpour) { BOOST_FOREACH(const JSDescription &pour, tx.vpour) {
BOOST_FOREACH(const uint256 &serial, pour.serials) { BOOST_FOREACH(const uint256 &serial, pour.serials) {
std::map<uint256, const CTransaction*>::iterator it = mapSerials.find(serial); std::map<uint256, const CTransaction*>::iterator it = mapSerials.find(serial);
if (it != mapSerials.end()) { if (it != mapSerials.end()) {
@@ -317,7 +317,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
boost::unordered_map<uint256, ZCIncrementalMerkleTree, CCoinsKeyHasher> intermediates; boost::unordered_map<uint256, ZCIncrementalMerkleTree, CCoinsKeyHasher> intermediates;
BOOST_FOREACH(const CPourTx &pour, tx.vpour) { BOOST_FOREACH(const JSDescription &pour, tx.vpour) {
BOOST_FOREACH(const uint256 &serial, pour.serials) { BOOST_FOREACH(const uint256 &serial, pour.serials) {
assert(!pcoins->GetSerial(serial)); assert(!pcoins->GetSerial(serial));
} }

View File

@@ -2393,18 +2393,18 @@ Value zc_benchmark(const json_spirit::Array& params, bool fHelp)
pzcashParams->loadProvingKey(); pzcashParams->loadProvingKey();
} }
CPourTx* samplejoinsplit = NULL; JSDescription* samplejoinsplit = NULL;
if (benchmarktype == "verifyjoinsplit") { if (benchmarktype == "verifyjoinsplit") {
uint256 pubKeyHash; uint256 pubKeyHash;
uint256 anchor = ZCIncrementalMerkleTree().root(); uint256 anchor = ZCIncrementalMerkleTree().root();
samplejoinsplit = new CPourTx(*pzcashParams, samplejoinsplit = new JSDescription(*pzcashParams,
pubKeyHash, pubKeyHash,
anchor, anchor,
{JSInput(), JSInput()}, {JSInput(), JSInput()},
{JSOutput(), JSOutput()}, {JSOutput(), JSOutput()},
0, 0,
0); 0);
} }
for (int i = 0; i < samplecount; i++) { for (int i = 0; i < samplecount; i++) {
@@ -2644,7 +2644,7 @@ Value zc_raw_pour(const json_spirit::Array& params, bool fHelp)
mtx.nVersion = 2; mtx.nVersion = 2;
mtx.joinSplitPubKey = joinSplitPubKey; mtx.joinSplitPubKey = joinSplitPubKey;
CPourTx pourtx(*pzcashParams, JSDescription pourtx(*pzcashParams,
joinSplitPubKey, joinSplitPubKey,
anchor, anchor,
{vpourin[0], vpourin[1]}, {vpourin[0], vpourin[1]},

View File

@@ -1065,7 +1065,7 @@ void CWallet::WitnessBucketCommitment(std::vector<uint256> commitments,
BOOST_FOREACH(const CTransaction& tx, block.vtx) BOOST_FOREACH(const CTransaction& tx, block.vtx)
{ {
BOOST_FOREACH(const CPourTx& pour, tx.vpour) BOOST_FOREACH(const JSDescription& pour, tx.vpour)
{ {
BOOST_FOREACH(const uint256 &bucket_commitment, pour.commitments) BOOST_FOREACH(const uint256 &bucket_commitment, pour.commitments)
{ {

View File

@@ -76,7 +76,7 @@ double benchmark_create_joinsplit()
uint256 anchor = ZCIncrementalMerkleTree().root(); uint256 anchor = ZCIncrementalMerkleTree().root();
timer_start(); timer_start();
CPourTx pourtx(*pzcashParams, JSDescription pourtx(*pzcashParams,
pubKeyHash, pubKeyHash,
anchor, anchor,
{JSInput(), JSInput()}, {JSInput(), JSInput()},
@@ -89,7 +89,7 @@ double benchmark_create_joinsplit()
return ret; return ret;
} }
double benchmark_verify_joinsplit(const CPourTx &joinsplit) double benchmark_verify_joinsplit(const JSDescription &joinsplit)
{ {
timer_start(); timer_start();
uint256 pubKeyHash; uint256 pubKeyHash;

View File

@@ -8,7 +8,7 @@ extern double benchmark_sleep();
extern double benchmark_parameter_loading(); extern double benchmark_parameter_loading();
extern double benchmark_create_joinsplit(); extern double benchmark_create_joinsplit();
extern double benchmark_solve_equihash(); extern double benchmark_solve_equihash();
extern double benchmark_verify_joinsplit(const CPourTx &joinsplit); extern double benchmark_verify_joinsplit(const JSDescription &joinsplit);
extern double benchmark_verify_equihash(); extern double benchmark_verify_equihash();
extern double benchmark_large_tx(); extern double benchmark_large_tx();