Rename CPourTx to JSDescription.
This commit is contained in:
@@ -224,7 +224,7 @@ BOOST_AUTO_TEST_CASE(chained_pours)
|
||||
|
||||
ZCIncrementalMerkleTree tree;
|
||||
|
||||
CPourTx ptx1;
|
||||
JSDescription ptx1;
|
||||
ptx1.anchor = tree.root();
|
||||
ptx1.commitments[0] = 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
|
||||
// two pours create the same treestate twice, we should
|
||||
// still be able to anchor to it.
|
||||
CPourTx ptx1b;
|
||||
JSDescription ptx1b;
|
||||
ptx1b.anchor = tree.root();
|
||||
ptx1b.commitments[0] = ptx1.commitments[0];
|
||||
ptx1b.commitments[1] = ptx1.commitments[1];
|
||||
|
||||
CPourTx ptx2;
|
||||
CPourTx ptx3;
|
||||
JSDescription ptx2;
|
||||
JSDescription ptx3;
|
||||
|
||||
ptx2.anchor = tree.root();
|
||||
ptx3.anchor = tree.root();
|
||||
|
||||
@@ -122,7 +122,7 @@ void static RandomTransaction(CMutableTransaction &tx, bool fSingle) {
|
||||
}
|
||||
if (tx.nVersion >= 2) {
|
||||
for (int pour = 0; pour < pours; pour++) {
|
||||
CPourTx pourtx;
|
||||
JSDescription pourtx;
|
||||
if (insecure_rand() % 2 == 0) {
|
||||
pourtx.vpub_old = insecure_rand() % 100000000;
|
||||
} else {
|
||||
|
||||
@@ -330,7 +330,7 @@ BOOST_AUTO_TEST_CASE(test_basic_pour_verification)
|
||||
|
||||
auto witness = merkleTree.witness();
|
||||
|
||||
// create CPourTx
|
||||
// create JSDescription
|
||||
uint256 pubKeyHash;
|
||||
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs = {
|
||||
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));
|
||||
|
||||
CDataStream ss(SER_DISK, CLIENT_VERSION);
|
||||
ss << pourtx;
|
||||
|
||||
CPourTx pourtx_deserialized;
|
||||
JSDescription pourtx_deserialized;
|
||||
ss >> pourtx_deserialized;
|
||||
|
||||
BOOST_CHECK(pourtx_deserialized == pourtx);
|
||||
@@ -357,13 +357,13 @@ BOOST_AUTO_TEST_CASE(test_basic_pour_verification)
|
||||
|
||||
{
|
||||
// Ensure that the balance equation is working.
|
||||
BOOST_CHECK_THROW(CPourTx(*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, 10, 0), 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.
|
||||
auto test = CPourTx(*p, pubKeyHash, rt, inputs, outputs, 0, 0);
|
||||
auto test = JSDescription(*p, pubKeyHash, rt, inputs, outputs, 0, 0);
|
||||
test.anchor = GetRandHash();
|
||||
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(state.GetRejectReason() == "bad-txns-vout-empty");
|
||||
|
||||
newTx.vpour.push_back(CPourTx());
|
||||
CPourTx *pourtx = &newTx.vpour[0];
|
||||
newTx.vpour.push_back(JSDescription());
|
||||
JSDescription *pourtx = &newTx.vpour[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(CPourTx());
|
||||
newTx.vpour.push_back(JSDescription());
|
||||
|
||||
CPourTx *pourtx = &newTx.vpour[0];
|
||||
JSDescription *pourtx = &newTx.vpour[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(CPourTx());
|
||||
newTx.vpour.push_back(JSDescription());
|
||||
|
||||
CPourTx *pourtx2 = &newTx.vpour[1];
|
||||
JSDescription *pourtx2 = &newTx.vpour[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(CPourTx());
|
||||
CPourTx *pourtx = &newTx.vpour[0];
|
||||
newTx.vpour.push_back(JSDescription());
|
||||
JSDescription *pourtx = &newTx.vpour[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(CPourTx());
|
||||
CPourTx *pourtx2 = &newTx.vpour[1];
|
||||
newTx.vpour.push_back(JSDescription());
|
||||
JSDescription *pourtx2 = &newTx.vpour[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(CPourTx());
|
||||
CPourTx *pourtx = &newTx.vpour[0];
|
||||
newTx.vpour.push_back(JSDescription());
|
||||
JSDescription *pourtx = &newTx.vpour[0];
|
||||
pourtx->serials[0] = GetRandHash();
|
||||
pourtx->serials[1] = GetRandHash();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user