diff --git a/src/coins.cpp b/src/coins.cpp index 51ef207bf..166cfd2a4 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -394,7 +394,7 @@ bool CCoinsViewCache::HavePourRequirements(const CTransaction& tx) const { boost::unordered_map intermediates; - BOOST_FOREACH(const JSDescription &pour, tx.vpour) + BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256& serial, pour.serials) { diff --git a/src/gtest/test_checktransaction.cpp b/src/gtest/test_checktransaction.cpp index 3978132cf..2c0c6829e 100644 --- a/src/gtest/test_checktransaction.cpp +++ b/src/gtest/test_checktransaction.cpp @@ -15,9 +15,9 @@ TEST(checktransaction_tests, check_vpub_not_both_nonzero) { CMutableTransaction newTx(tx); CValidationState state; - newTx.vpour.push_back(JSDescription()); + newTx.vjoinsplit.push_back(JSDescription()); - JSDescription *pourtx = &newTx.vpour[0]; + JSDescription *pourtx = &newTx.vjoinsplit[0]; pourtx->vpub_old = 1; pourtx->vpub_new = 1; diff --git a/src/main.cpp b/src/main.cpp index c2dd70885..7cb5b11e2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -876,7 +876,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state) return false; } else { // Ensure that zk-SNARKs verify - BOOST_FOREACH(const JSDescription &pour, tx.vpour) { + BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { if (!pour.Verify(*pzcashParams, tx.joinSplitPubKey)) { return state.DoS(100, error("CheckTransaction(): pour does not verify"), REJECT_INVALID, "bad-txns-pour-verification-failed"); @@ -891,11 +891,11 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio // Basic checks that don't depend on any context // Transactions can contain empty `vin` and `vout` so long as - // `vpour` is non-empty. - if (tx.vin.empty() && tx.vpour.empty()) + // `vjoinsplit` is non-empty. + if (tx.vin.empty() && tx.vjoinsplit.empty()) return state.DoS(10, error("CheckTransaction(): vin empty"), REJECT_INVALID, "bad-txns-vin-empty"); - if (tx.vout.empty() && tx.vpour.empty()) + if (tx.vout.empty() && tx.vjoinsplit.empty()) return state.DoS(10, error("CheckTransaction(): vout empty"), REJECT_INVALID, "bad-txns-vout-empty"); @@ -921,7 +921,7 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio } // Ensure that pour values are well-formed - BOOST_FOREACH(const JSDescription& pour, tx.vpour) + BOOST_FOREACH(const JSDescription& pour, tx.vjoinsplit) { if (pour.vpub_old < 0) { 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 set vPourSerials; - BOOST_FOREACH(const JSDescription& pour, tx.vpour) + BOOST_FOREACH(const JSDescription& pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256& serial, pour.serials) { @@ -983,7 +983,7 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio if (tx.IsCoinBase()) { // There should be no pours in a coinbase transaction - if (tx.vpour.size() > 0) + if (tx.vjoinsplit.size() > 0) return state.DoS(100, error("CheckTransaction(): coinbase has pours"), REJECT_INVALID, "bad-cb-has-pours"); @@ -998,7 +998,7 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio return state.DoS(10, error("CheckTransaction(): prevout is null"), REJECT_INVALID, "bad-txns-prevout-null"); - if (tx.vpour.size() > 0) { + if (tx.vjoinsplit.size() > 0) { // TODO: #966. static const uint256 one(uint256S("0000000000000000000000000000000000000000000000000000000000000001")); // Empty output script. @@ -1104,7 +1104,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa return false; } } - BOOST_FOREACH(const JSDescription &pour, tx.vpour) { + BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &serial, pour.serials) { if (pool.mapSerials.count(serial)) { @@ -1586,7 +1586,7 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach } // spend serials - BOOST_FOREACH(const JSDescription &pour, tx.vpour) { + BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &serial, pour.serials) { inputs.SetSerial(serial, true); } @@ -1908,7 +1908,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex } // unspend serials - BOOST_FOREACH(const JSDescription &pour, tx.vpour) { + BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &serial, pour.serials) { 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); - BOOST_FOREACH(const JSDescription &pour, tx.vpour) { + BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &bucket_commitment, pour.commitments) { // Insert the bucket commitments into our temporary tree. @@ -4734,7 +4734,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, EraseOrphanTx(hash); } // TODO: currently, prohibit pours from entering mapOrphans - else if (fMissingInputs && tx.vpour.size() == 0) + else if (fMissingInputs && tx.vjoinsplit.size() == 0) { AddOrphanTx(tx, pfrom->GetId()); diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index 0035d7d32..34775c228 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -111,7 +111,7 @@ std::string CTxOut::ToString() const CMutableTransaction::CMutableTransaction() : nVersion(CTransaction::CURRENT_VERSION), nLockTime(0) {} CMutableTransaction::CMutableTransaction(const CTransaction& tx) : nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime), - vpour(tx.vpour), joinSplitPubKey(tx.joinSplitPubKey), joinSplitSig(tx.joinSplitSig) + vjoinsplit(tx.vjoinsplit), joinSplitPubKey(tx.joinSplitPubKey), joinSplitSig(tx.joinSplitSig) { } @@ -126,9 +126,9 @@ void CTransaction::UpdateHash() const *const_cast(&hash) = SerializeHash(*this); } -CTransaction::CTransaction() : nVersion(CTransaction::CURRENT_VERSION), vin(), vout(), nLockTime(0), vpour(), joinSplitPubKey(), joinSplitSig() { } +CTransaction::CTransaction() : nVersion(CTransaction::CURRENT_VERSION), vin(), vout(), nLockTime(0), vjoinsplit(), joinSplitPubKey(), joinSplitSig() { } -CTransaction::CTransaction(const CMutableTransaction &tx) : nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime), vpour(tx.vpour), +CTransaction::CTransaction(const CMutableTransaction &tx) : nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime), vjoinsplit(tx.vjoinsplit), joinSplitPubKey(tx.joinSplitPubKey), joinSplitSig(tx.joinSplitSig) { UpdateHash(); @@ -139,7 +139,7 @@ CTransaction& CTransaction::operator=(const CTransaction &tx) { *const_cast*>(&vin) = tx.vin; *const_cast*>(&vout) = tx.vout; *const_cast(&nLockTime) = tx.nLockTime; - *const_cast*>(&vpour) = tx.vpour; + *const_cast*>(&vjoinsplit) = tx.vjoinsplit; *const_cast(&joinSplitPubKey) = tx.joinSplitPubKey; *const_cast(&joinSplitSig) = tx.joinSplitSig; *const_cast(&hash) = tx.hash; @@ -156,7 +156,7 @@ CAmount CTransaction::GetValueOut() const throw std::runtime_error("CTransaction::GetValueOut(): value out of range"); } - for (std::vector::const_iterator it(vpour.begin()); it != vpour.end(); ++it) + for (std::vector::const_iterator it(vjoinsplit.begin()); it != vjoinsplit.end(); ++it) { // NB: vpub_old "takes" money from the value pool just as outputs do nValueOut += it->vpub_old; @@ -170,7 +170,7 @@ CAmount CTransaction::GetValueOut() const CAmount CTransaction::GetPourValueIn() const { CAmount nValue = 0; - for (std::vector::const_iterator it(vpour.begin()); it != vpour.end(); ++it) + for (std::vector::const_iterator it(vjoinsplit.begin()); it != vjoinsplit.end(); ++it) { // NB: vpub_new "gives" money to the value pool just as inputs do nValue += it->vpub_new; diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 9a2a15ead..c6fad76e2 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -303,7 +303,7 @@ public: const std::vector vin; const std::vector vout; const uint32_t nLockTime; - const std::vector vpour; + const std::vector vjoinsplit; const uint256 joinSplitPubKey; const joinsplit_sig_t joinSplitSig; @@ -325,8 +325,8 @@ public: READWRITE(*const_cast*>(&vout)); READWRITE(*const_cast(&nLockTime)); if (nVersion >= 2) { - READWRITE(*const_cast*>(&vpour)); - if (vpour.size() > 0) { + READWRITE(*const_cast*>(&vjoinsplit)); + if (vjoinsplit.size() > 0) { READWRITE(*const_cast(&joinSplitPubKey)); READWRITE(*const_cast(&joinSplitSig)); } @@ -382,7 +382,7 @@ struct CMutableTransaction std::vector vin; std::vector vout; uint32_t nLockTime; - std::vector vpour; + std::vector vjoinsplit; uint256 joinSplitPubKey; CTransaction::joinsplit_sig_t joinSplitSig; @@ -399,8 +399,8 @@ struct CMutableTransaction READWRITE(vout); READWRITE(nLockTime); if (nVersion >= 2) { - READWRITE(vpour); - if (vpour.size() > 0) { + READWRITE(vjoinsplit); + if (vjoinsplit.size() > 0) { READWRITE(joinSplitPubKey); READWRITE(joinSplitSig); } diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 818e38a6f..13d171f4e 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -90,9 +90,9 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) } entry.push_back(Pair("vout", vout)); - Array vpour; - for (unsigned int i = 0; i < tx.vpour.size(); i++) { - const JSDescription& pourtx = tx.vpour[i]; + Array vjoinsplit; + for (unsigned int i = 0; i < tx.vjoinsplit.size(); i++) { + const JSDescription& pourtx = tx.vjoinsplit[i]; Object pour; pour.push_back(Pair("anchor", pourtx.anchor.GetHex())); @@ -128,10 +128,10 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) uint256 pubKeyHash; pour.push_back(Pair("valid", pourtx.Verify(*pzcashParams, pubKeyHash))); - vpour.push_back(pour); + vjoinsplit.push_back(pour); } - entry.push_back(Pair("vpour", vpour)); + entry.push_back(Pair("vjoinsplit", vjoinsplit)); if (!hashBlock.IsNull()) { entry.push_back(Pair("blockhash", hashBlock.GetHex())); diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index c0e35bafa..d494ef4fa 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1072,7 +1072,7 @@ public: // Serialize nLockTime ::Serialize(s, txTo.nLockTime, nType, nVersion); - // Serialize vpour + // Serialize vjoinsplit if (txTo.nVersion >= 2) { // // SIGHASH_* functions will hash portions of @@ -1080,8 +1080,8 @@ public: // keeps the JoinSplit cryptographically bound // to the transaction. // - ::Serialize(s, txTo.vpour, nType, nVersion); - if (txTo.vpour.size() > 0) { + ::Serialize(s, txTo.vjoinsplit, nType, nVersion); + if (txTo.vjoinsplit.size() > 0) { ::Serialize(s, txTo.joinSplitPubKey, nType, nVersion); CTransaction::joinsplit_sig_t nullSig = {}; diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp index 032f66ba0..776d72372 100644 --- a/src/test/coins_tests.cpp +++ b/src/test/coins_tests.cpp @@ -251,7 +251,7 @@ BOOST_AUTO_TEST_CASE(chained_pours) { CMutableTransaction mtx; - mtx.vpour.push_back(ptx2); + mtx.vjoinsplit.push_back(ptx2); BOOST_CHECK(!cache.HavePourRequirements(mtx)); } @@ -260,35 +260,35 @@ BOOST_AUTO_TEST_CASE(chained_pours) // ptx2 is trying to anchor to ptx1 but ptx1 // appears afterwards -- not a permitted ordering CMutableTransaction mtx; - mtx.vpour.push_back(ptx2); - mtx.vpour.push_back(ptx1); + mtx.vjoinsplit.push_back(ptx2); + mtx.vjoinsplit.push_back(ptx1); BOOST_CHECK(!cache.HavePourRequirements(mtx)); } { CMutableTransaction mtx; - mtx.vpour.push_back(ptx1); - mtx.vpour.push_back(ptx2); + mtx.vjoinsplit.push_back(ptx1); + mtx.vjoinsplit.push_back(ptx2); BOOST_CHECK(cache.HavePourRequirements(mtx)); } { CMutableTransaction mtx; - mtx.vpour.push_back(ptx1); - mtx.vpour.push_back(ptx2); - mtx.vpour.push_back(ptx3); + mtx.vjoinsplit.push_back(ptx1); + mtx.vjoinsplit.push_back(ptx2); + mtx.vjoinsplit.push_back(ptx3); BOOST_CHECK(cache.HavePourRequirements(mtx)); } { CMutableTransaction mtx; - mtx.vpour.push_back(ptx1); - mtx.vpour.push_back(ptx1b); - mtx.vpour.push_back(ptx2); - mtx.vpour.push_back(ptx3); + mtx.vjoinsplit.push_back(ptx1); + mtx.vjoinsplit.push_back(ptx1b); + mtx.vjoinsplit.push_back(ptx2); + mtx.vjoinsplit.push_back(ptx3); BOOST_CHECK(cache.HavePourRequirements(mtx)); } diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index 352ed8781..716b043cf 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -140,7 +140,7 @@ void static RandomTransaction(CMutableTransaction &tx, bool fSingle) { pourtx.macs[0] = GetRandHash(); pourtx.macs[1] = GetRandHash(); - tx.vpour.push_back(pourtx); + tx.vjoinsplit.push_back(pourtx); } unsigned char joinSplitPrivKey[crypto_sign_SECRETKEYBYTES]; diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index b0ee9d5c7..84b53d141 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -393,8 +393,8 @@ BOOST_AUTO_TEST_CASE(test_simple_pour_invalidity) BOOST_CHECK(!CheckTransactionWithoutProofVerification(newTx, state)); BOOST_CHECK(state.GetRejectReason() == "bad-txns-vout-empty"); - newTx.vpour.push_back(JSDescription()); - JSDescription *pourtx = &newTx.vpour[0]; + newTx.vjoinsplit.push_back(JSDescription()); + JSDescription *pourtx = &newTx.vjoinsplit[0]; pourtx->serials[0] = GetRandHash(); pourtx->serials[1] = GetRandHash(); @@ -422,9 +422,9 @@ BOOST_AUTO_TEST_CASE(test_simple_pour_invalidity) CMutableTransaction newTx(tx); CValidationState state; - newTx.vpour.push_back(JSDescription()); + newTx.vjoinsplit.push_back(JSDescription()); - JSDescription *pourtx = &newTx.vpour[0]; + JSDescription *pourtx = &newTx.vjoinsplit[0]; pourtx->vpub_old = -1; BOOST_CHECK(!CheckTransaction(newTx, state)); @@ -448,9 +448,9 @@ BOOST_AUTO_TEST_CASE(test_simple_pour_invalidity) pourtx->vpub_new = (MAX_MONEY / 2) + 10; - newTx.vpour.push_back(JSDescription()); + newTx.vjoinsplit.push_back(JSDescription()); - JSDescription *pourtx2 = &newTx.vpour[1]; + JSDescription *pourtx2 = &newTx.vjoinsplit[1]; pourtx2->vpub_new = (MAX_MONEY / 2) + 10; BOOST_CHECK(!CheckTransaction(newTx, state)); @@ -461,8 +461,8 @@ BOOST_AUTO_TEST_CASE(test_simple_pour_invalidity) CMutableTransaction newTx(tx); CValidationState state; - newTx.vpour.push_back(JSDescription()); - JSDescription *pourtx = &newTx.vpour[0]; + newTx.vjoinsplit.push_back(JSDescription()); + JSDescription *pourtx = &newTx.vjoinsplit[0]; pourtx->serials[0] = GetRandHash(); pourtx->serials[1] = pourtx->serials[0]; @@ -472,8 +472,8 @@ BOOST_AUTO_TEST_CASE(test_simple_pour_invalidity) pourtx->serials[1] = GetRandHash(); - newTx.vpour.push_back(JSDescription()); - JSDescription *pourtx2 = &newTx.vpour[1]; + newTx.vjoinsplit.push_back(JSDescription()); + JSDescription *pourtx2 = &newTx.vjoinsplit[1]; pourtx2->serials[0] = GetRandHash(); pourtx2->serials[1] = pourtx->serials[0]; @@ -486,8 +486,8 @@ BOOST_AUTO_TEST_CASE(test_simple_pour_invalidity) CMutableTransaction newTx(tx); CValidationState state; - newTx.vpour.push_back(JSDescription()); - JSDescription *pourtx = &newTx.vpour[0]; + newTx.vjoinsplit.push_back(JSDescription()); + JSDescription *pourtx = &newTx.vjoinsplit[0]; pourtx->serials[0] = GetRandHash(); pourtx->serials[1] = GetRandHash(); diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 9a4b6c24f..3023962f6 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -99,7 +99,7 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, const CTransaction& tx = mapTx[hash].GetTx(); for (unsigned int i = 0; i < tx.vin.size(); i++) mapNextTx[tx.vin[i].prevout] = CInPoint(&tx, i); - BOOST_FOREACH(const JSDescription &pour, tx.vpour) { + BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &serial, pour.serials) { mapSerials[serial] = &tx; } @@ -148,7 +148,7 @@ void CTxMemPool::remove(const CTransaction &origTx, std::list& rem } BOOST_FOREACH(const CTxIn& txin, tx.vin) mapNextTx.erase(txin.prevout); - BOOST_FOREACH(const JSDescription& pour, tx.vpour) { + BOOST_FOREACH(const JSDescription& pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256& serial, pour.serials) { mapSerials.erase(serial); } @@ -200,7 +200,7 @@ void CTxMemPool::removeWithAnchor(const uint256 &invalidRoot) for (std::map::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) { const CTransaction& tx = it->second.GetTx(); - BOOST_FOREACH(const JSDescription& pour, tx.vpour) { + BOOST_FOREACH(const JSDescription& pour, tx.vjoinsplit) { if (pour.anchor == invalidRoot) { transactionsToRemove.push_back(tx); break; @@ -230,7 +230,7 @@ void CTxMemPool::removeConflicts(const CTransaction &tx, std::list } } - BOOST_FOREACH(const JSDescription &pour, tx.vpour) { + BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &serial, pour.serials) { std::map::iterator it = mapSerials.find(serial); if (it != mapSerials.end()) { @@ -317,7 +317,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const boost::unordered_map intermediates; - BOOST_FOREACH(const JSDescription &pour, tx.vpour) { + BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &serial, pour.serials) { assert(!pcoins->GetSerial(serial)); } diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 81fe0e656..f89147efe 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2654,7 +2654,7 @@ Value zc_raw_pour(const json_spirit::Array& params, bool fHelp) assert(pourtx.Verify(*pzcashParams, joinSplitPubKey)); - mtx.vpour.push_back(pourtx); + mtx.vjoinsplit.push_back(pourtx); // TODO: #966. static const uint256 one(uint256S("0000000000000000000000000000000000000000000000000000000000000001")); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 66c028591..354a31be9 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1065,7 +1065,7 @@ void CWallet::WitnessBucketCommitment(std::vector commitments, BOOST_FOREACH(const CTransaction& tx, block.vtx) { - BOOST_FOREACH(const JSDescription& pour, tx.vpour) + BOOST_FOREACH(const JSDescription& pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &bucket_commitment, pour.commitments) {