Rename vpour to vjoinsplit.
This commit is contained in:
parent
a8c68ffe99
commit
8675d94b63
|
@ -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 JSDescription &pour, tx.vpour)
|
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const uint256& serial, pour.serials)
|
BOOST_FOREACH(const uint256& serial, pour.serials)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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(JSDescription());
|
newTx.vjoinsplit.push_back(JSDescription());
|
||||||
|
|
||||||
JSDescription *pourtx = &newTx.vpour[0];
|
JSDescription *pourtx = &newTx.vjoinsplit[0];
|
||||||
pourtx->vpub_old = 1;
|
pourtx->vpub_old = 1;
|
||||||
pourtx->vpub_new = 1;
|
pourtx->vpub_new = 1;
|
||||||
|
|
||||||
|
|
26
src/main.cpp
26
src/main.cpp
|
@ -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 JSDescription &pour, tx.vpour) {
|
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) {
|
||||||
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");
|
||||||
|
@ -891,11 +891,11 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio
|
||||||
// Basic checks that don't depend on any context
|
// Basic checks that don't depend on any context
|
||||||
|
|
||||||
// Transactions can contain empty `vin` and `vout` so long as
|
// Transactions can contain empty `vin` and `vout` so long as
|
||||||
// `vpour` is non-empty.
|
// `vjoinsplit` is non-empty.
|
||||||
if (tx.vin.empty() && tx.vpour.empty())
|
if (tx.vin.empty() && tx.vjoinsplit.empty())
|
||||||
return state.DoS(10, error("CheckTransaction(): vin empty"),
|
return state.DoS(10, error("CheckTransaction(): vin empty"),
|
||||||
REJECT_INVALID, "bad-txns-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"),
|
return state.DoS(10, error("CheckTransaction(): vout empty"),
|
||||||
REJECT_INVALID, "bad-txns-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
|
// 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) {
|
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 JSDescription& pour, tx.vpour)
|
BOOST_FOREACH(const JSDescription& pour, tx.vjoinsplit)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const uint256& serial, pour.serials)
|
BOOST_FOREACH(const uint256& serial, pour.serials)
|
||||||
{
|
{
|
||||||
|
@ -983,7 +983,7 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio
|
||||||
if (tx.IsCoinBase())
|
if (tx.IsCoinBase())
|
||||||
{
|
{
|
||||||
// There should be no pours in a coinbase transaction
|
// 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"),
|
return state.DoS(100, error("CheckTransaction(): coinbase has pours"),
|
||||||
REJECT_INVALID, "bad-cb-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"),
|
return state.DoS(10, error("CheckTransaction(): prevout is null"),
|
||||||
REJECT_INVALID, "bad-txns-prevout-null");
|
REJECT_INVALID, "bad-txns-prevout-null");
|
||||||
|
|
||||||
if (tx.vpour.size() > 0) {
|
if (tx.vjoinsplit.size() > 0) {
|
||||||
// TODO: #966.
|
// TODO: #966.
|
||||||
static const uint256 one(uint256S("0000000000000000000000000000000000000000000000000000000000000001"));
|
static const uint256 one(uint256S("0000000000000000000000000000000000000000000000000000000000000001"));
|
||||||
// Empty output script.
|
// Empty output script.
|
||||||
|
@ -1104,7 +1104,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BOOST_FOREACH(const JSDescription &pour, tx.vpour) {
|
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) {
|
||||||
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 JSDescription &pour, tx.vpour) {
|
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) {
|
||||||
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 JSDescription &pour, tx.vpour) {
|
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) {
|
||||||
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 JSDescription &pour, tx.vpour) {
|
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) {
|
||||||
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.
|
||||||
|
|
||||||
|
@ -4734,7 +4734,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||||
EraseOrphanTx(hash);
|
EraseOrphanTx(hash);
|
||||||
}
|
}
|
||||||
// TODO: currently, prohibit pours from entering mapOrphans
|
// 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());
|
AddOrphanTx(tx, pfrom->GetId());
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ std::string CTxOut::ToString() const
|
||||||
|
|
||||||
CMutableTransaction::CMutableTransaction() : nVersion(CTransaction::CURRENT_VERSION), nLockTime(0) {}
|
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),
|
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<uint256*>(&hash) = SerializeHash(*this);
|
*const_cast<uint256*>(&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)
|
joinSplitPubKey(tx.joinSplitPubKey), joinSplitSig(tx.joinSplitSig)
|
||||||
{
|
{
|
||||||
UpdateHash();
|
UpdateHash();
|
||||||
|
@ -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<JSDescription>*>(&vpour) = tx.vpour;
|
*const_cast<std::vector<JSDescription>*>(&vjoinsplit) = tx.vjoinsplit;
|
||||||
*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<JSDescription>::const_iterator it(vpour.begin()); it != vpour.end(); ++it)
|
for (std::vector<JSDescription>::const_iterator it(vjoinsplit.begin()); it != vjoinsplit.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<JSDescription>::const_iterator it(vpour.begin()); it != vpour.end(); ++it)
|
for (std::vector<JSDescription>::const_iterator it(vjoinsplit.begin()); it != vjoinsplit.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;
|
||||||
|
|
|
@ -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<JSDescription> vpour;
|
const std::vector<JSDescription> vjoinsplit;
|
||||||
const uint256 joinSplitPubKey;
|
const uint256 joinSplitPubKey;
|
||||||
const joinsplit_sig_t joinSplitSig;
|
const joinsplit_sig_t joinSplitSig;
|
||||||
|
|
||||||
|
@ -325,8 +325,8 @@ 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<JSDescription>*>(&vpour));
|
READWRITE(*const_cast<std::vector<JSDescription>*>(&vjoinsplit));
|
||||||
if (vpour.size() > 0) {
|
if (vjoinsplit.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<JSDescription> vpour;
|
std::vector<JSDescription> vjoinsplit;
|
||||||
uint256 joinSplitPubKey;
|
uint256 joinSplitPubKey;
|
||||||
CTransaction::joinsplit_sig_t joinSplitSig;
|
CTransaction::joinsplit_sig_t joinSplitSig;
|
||||||
|
|
||||||
|
@ -399,8 +399,8 @@ struct CMutableTransaction
|
||||||
READWRITE(vout);
|
READWRITE(vout);
|
||||||
READWRITE(nLockTime);
|
READWRITE(nLockTime);
|
||||||
if (nVersion >= 2) {
|
if (nVersion >= 2) {
|
||||||
READWRITE(vpour);
|
READWRITE(vjoinsplit);
|
||||||
if (vpour.size() > 0) {
|
if (vjoinsplit.size() > 0) {
|
||||||
READWRITE(joinSplitPubKey);
|
READWRITE(joinSplitPubKey);
|
||||||
READWRITE(joinSplitSig);
|
READWRITE(joinSplitSig);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,9 +90,9 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
|
||||||
}
|
}
|
||||||
entry.push_back(Pair("vout", vout));
|
entry.push_back(Pair("vout", vout));
|
||||||
|
|
||||||
Array vpour;
|
Array vjoinsplit;
|
||||||
for (unsigned int i = 0; i < tx.vpour.size(); i++) {
|
for (unsigned int i = 0; i < tx.vjoinsplit.size(); i++) {
|
||||||
const JSDescription& pourtx = tx.vpour[i];
|
const JSDescription& pourtx = tx.vjoinsplit[i];
|
||||||
Object pour;
|
Object pour;
|
||||||
|
|
||||||
pour.push_back(Pair("anchor", pourtx.anchor.GetHex()));
|
pour.push_back(Pair("anchor", pourtx.anchor.GetHex()));
|
||||||
|
@ -128,10 +128,10 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
|
||||||
uint256 pubKeyHash;
|
uint256 pubKeyHash;
|
||||||
pour.push_back(Pair("valid", pourtx.Verify(*pzcashParams, 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()) {
|
if (!hashBlock.IsNull()) {
|
||||||
entry.push_back(Pair("blockhash", hashBlock.GetHex()));
|
entry.push_back(Pair("blockhash", hashBlock.GetHex()));
|
||||||
|
|
|
@ -1072,7 +1072,7 @@ public:
|
||||||
// Serialize nLockTime
|
// Serialize nLockTime
|
||||||
::Serialize(s, txTo.nLockTime, nType, nVersion);
|
::Serialize(s, txTo.nLockTime, nType, nVersion);
|
||||||
|
|
||||||
// Serialize vpour
|
// Serialize vjoinsplit
|
||||||
if (txTo.nVersion >= 2) {
|
if (txTo.nVersion >= 2) {
|
||||||
//
|
//
|
||||||
// SIGHASH_* functions will hash portions of
|
// SIGHASH_* functions will hash portions of
|
||||||
|
@ -1080,8 +1080,8 @@ public:
|
||||||
// keeps the JoinSplit cryptographically bound
|
// keeps the JoinSplit cryptographically bound
|
||||||
// to the transaction.
|
// to the transaction.
|
||||||
//
|
//
|
||||||
::Serialize(s, txTo.vpour, nType, nVersion);
|
::Serialize(s, txTo.vjoinsplit, nType, nVersion);
|
||||||
if (txTo.vpour.size() > 0) {
|
if (txTo.vjoinsplit.size() > 0) {
|
||||||
::Serialize(s, txTo.joinSplitPubKey, nType, nVersion);
|
::Serialize(s, txTo.joinSplitPubKey, nType, nVersion);
|
||||||
|
|
||||||
CTransaction::joinsplit_sig_t nullSig = {};
|
CTransaction::joinsplit_sig_t nullSig = {};
|
||||||
|
|
|
@ -251,7 +251,7 @@ BOOST_AUTO_TEST_CASE(chained_pours)
|
||||||
|
|
||||||
{
|
{
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
mtx.vpour.push_back(ptx2);
|
mtx.vjoinsplit.push_back(ptx2);
|
||||||
|
|
||||||
BOOST_CHECK(!cache.HavePourRequirements(mtx));
|
BOOST_CHECK(!cache.HavePourRequirements(mtx));
|
||||||
}
|
}
|
||||||
|
@ -260,35 +260,35 @@ BOOST_AUTO_TEST_CASE(chained_pours)
|
||||||
// ptx2 is trying to anchor to ptx1 but ptx1
|
// ptx2 is trying to anchor to ptx1 but ptx1
|
||||||
// appears afterwards -- not a permitted ordering
|
// appears afterwards -- not a permitted ordering
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
mtx.vpour.push_back(ptx2);
|
mtx.vjoinsplit.push_back(ptx2);
|
||||||
mtx.vpour.push_back(ptx1);
|
mtx.vjoinsplit.push_back(ptx1);
|
||||||
|
|
||||||
BOOST_CHECK(!cache.HavePourRequirements(mtx));
|
BOOST_CHECK(!cache.HavePourRequirements(mtx));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
mtx.vpour.push_back(ptx1);
|
mtx.vjoinsplit.push_back(ptx1);
|
||||||
mtx.vpour.push_back(ptx2);
|
mtx.vjoinsplit.push_back(ptx2);
|
||||||
|
|
||||||
BOOST_CHECK(cache.HavePourRequirements(mtx));
|
BOOST_CHECK(cache.HavePourRequirements(mtx));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
mtx.vpour.push_back(ptx1);
|
mtx.vjoinsplit.push_back(ptx1);
|
||||||
mtx.vpour.push_back(ptx2);
|
mtx.vjoinsplit.push_back(ptx2);
|
||||||
mtx.vpour.push_back(ptx3);
|
mtx.vjoinsplit.push_back(ptx3);
|
||||||
|
|
||||||
BOOST_CHECK(cache.HavePourRequirements(mtx));
|
BOOST_CHECK(cache.HavePourRequirements(mtx));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
mtx.vpour.push_back(ptx1);
|
mtx.vjoinsplit.push_back(ptx1);
|
||||||
mtx.vpour.push_back(ptx1b);
|
mtx.vjoinsplit.push_back(ptx1b);
|
||||||
mtx.vpour.push_back(ptx2);
|
mtx.vjoinsplit.push_back(ptx2);
|
||||||
mtx.vpour.push_back(ptx3);
|
mtx.vjoinsplit.push_back(ptx3);
|
||||||
|
|
||||||
BOOST_CHECK(cache.HavePourRequirements(mtx));
|
BOOST_CHECK(cache.HavePourRequirements(mtx));
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ void static RandomTransaction(CMutableTransaction &tx, bool fSingle) {
|
||||||
pourtx.macs[0] = GetRandHash();
|
pourtx.macs[0] = GetRandHash();
|
||||||
pourtx.macs[1] = GetRandHash();
|
pourtx.macs[1] = GetRandHash();
|
||||||
|
|
||||||
tx.vpour.push_back(pourtx);
|
tx.vjoinsplit.push_back(pourtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char joinSplitPrivKey[crypto_sign_SECRETKEYBYTES];
|
unsigned char joinSplitPrivKey[crypto_sign_SECRETKEYBYTES];
|
||||||
|
|
|
@ -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(JSDescription());
|
newTx.vjoinsplit.push_back(JSDescription());
|
||||||
JSDescription *pourtx = &newTx.vpour[0];
|
JSDescription *pourtx = &newTx.vjoinsplit[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(JSDescription());
|
newTx.vjoinsplit.push_back(JSDescription());
|
||||||
|
|
||||||
JSDescription *pourtx = &newTx.vpour[0];
|
JSDescription *pourtx = &newTx.vjoinsplit[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(JSDescription());
|
newTx.vjoinsplit.push_back(JSDescription());
|
||||||
|
|
||||||
JSDescription *pourtx2 = &newTx.vpour[1];
|
JSDescription *pourtx2 = &newTx.vjoinsplit[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(JSDescription());
|
newTx.vjoinsplit.push_back(JSDescription());
|
||||||
JSDescription *pourtx = &newTx.vpour[0];
|
JSDescription *pourtx = &newTx.vjoinsplit[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(JSDescription());
|
newTx.vjoinsplit.push_back(JSDescription());
|
||||||
JSDescription *pourtx2 = &newTx.vpour[1];
|
JSDescription *pourtx2 = &newTx.vjoinsplit[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(JSDescription());
|
newTx.vjoinsplit.push_back(JSDescription());
|
||||||
JSDescription *pourtx = &newTx.vpour[0];
|
JSDescription *pourtx = &newTx.vjoinsplit[0];
|
||||||
pourtx->serials[0] = GetRandHash();
|
pourtx->serials[0] = GetRandHash();
|
||||||
pourtx->serials[1] = GetRandHash();
|
pourtx->serials[1] = GetRandHash();
|
||||||
|
|
||||||
|
|
|
@ -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 JSDescription &pour, tx.vpour) {
|
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) {
|
||||||
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 JSDescription& pour, tx.vpour) {
|
BOOST_FOREACH(const JSDescription& pour, tx.vjoinsplit) {
|
||||||
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 JSDescription& pour, tx.vpour) {
|
BOOST_FOREACH(const JSDescription& pour, tx.vjoinsplit) {
|
||||||
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 JSDescription &pour, tx.vpour) {
|
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) {
|
||||||
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 JSDescription &pour, tx.vpour) {
|
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) {
|
||||||
BOOST_FOREACH(const uint256 &serial, pour.serials) {
|
BOOST_FOREACH(const uint256 &serial, pour.serials) {
|
||||||
assert(!pcoins->GetSerial(serial));
|
assert(!pcoins->GetSerial(serial));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2654,7 +2654,7 @@ Value zc_raw_pour(const json_spirit::Array& params, bool fHelp)
|
||||||
|
|
||||||
assert(pourtx.Verify(*pzcashParams, joinSplitPubKey));
|
assert(pourtx.Verify(*pzcashParams, joinSplitPubKey));
|
||||||
|
|
||||||
mtx.vpour.push_back(pourtx);
|
mtx.vjoinsplit.push_back(pourtx);
|
||||||
|
|
||||||
// TODO: #966.
|
// TODO: #966.
|
||||||
static const uint256 one(uint256S("0000000000000000000000000000000000000000000000000000000000000001"));
|
static const uint256 one(uint256S("0000000000000000000000000000000000000000000000000000000000000001"));
|
||||||
|
|
|
@ -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 JSDescription& pour, tx.vpour)
|
BOOST_FOREACH(const JSDescription& pour, tx.vjoinsplit)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const uint256 &bucket_commitment, pour.commitments)
|
BOOST_FOREACH(const uint256 &bucket_commitment, pour.commitments)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue