diff --git a/src/gtest/test_checktransaction.cpp b/src/gtest/test_checktransaction.cpp index 0d1c96920..1431c9388 100644 --- a/src/gtest/test_checktransaction.cpp +++ b/src/gtest/test_checktransaction.cpp @@ -7,6 +7,7 @@ #include "consensus/validation.h" #include "transaction_builder.h" #include "utiltest.h" +#include "zcash/JoinSplit.hpp" #include @@ -51,10 +52,18 @@ public: void CreateJoinSplitSignature(CMutableTransaction& mtx, uint32_t consensusBranchId); -CMutableTransaction GetValidTransaction() { - uint32_t consensusBranchId = SPROUT_BRANCH_ID; - +CMutableTransaction GetValidTransaction(uint32_t consensusBranchId=SPROUT_BRANCH_ID) { CMutableTransaction mtx; + if (consensusBranchId == NetworkUpgradeInfo[Consensus::UPGRADE_OVERWINTER].nBranchId) { + mtx.fOverwintered = true; + mtx.nVersionGroupId = OVERWINTER_VERSION_GROUP_ID; + mtx.nVersion = OVERWINTER_TX_VERSION; + } else if (consensusBranchId == NetworkUpgradeInfo[Consensus::UPGRADE_SAPLING].nBranchId) { + mtx.fOverwintered = true; + mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID; + mtx.nVersion = SAPLING_TX_VERSION; + } + mtx.vin.resize(2); mtx.vin[0].prevout.hash = uint256S("0000000000000000000000000000000000000000000000000000000000000001"); mtx.vin[0].prevout.n = 0; @@ -70,6 +79,12 @@ CMutableTransaction GetValidTransaction() { mtx.vJoinSplit[1].nullifiers.at(0) = uint256S("0000000000000000000000000000000000000000000000000000000000000002"); mtx.vJoinSplit[1].nullifiers.at(1) = uint256S("0000000000000000000000000000000000000000000000000000000000000003"); + if (mtx.nVersion >= SAPLING_TX_VERSION) { + libzcash::GrothProof emptyProof; + mtx.vJoinSplit[0].proof = emptyProof; + mtx.vJoinSplit[1].proof = emptyProof; + } + CreateJoinSplitSignature(mtx, consensusBranchId); return mtx; } diff --git a/src/gtest/test_mempool.cpp b/src/gtest/test_mempool.cpp index 48e322b76..76f8c510e 100644 --- a/src/gtest/test_mempool.cpp +++ b/src/gtest/test_mempool.cpp @@ -11,7 +11,7 @@ #include "util.h" // Implementation is in test_checktransaction.cpp -extern CMutableTransaction GetValidTransaction(); +extern CMutableTransaction GetValidTransaction(uint32_t consensusBranchId=SPROUT_BRANCH_ID); // Fake the input of transaction 5295156213414ed77f6e538e7e8ebe14492156906b9fe995b242477818789364 // - 532639cc6bebed47c1c69ae36dd498c68a012e74ad12729adbd3dbb56f8f3f4a, 0