#include "utiltest.h"
+#include "consensus/upgrades.h"
+
CWalletTx GetValidReceive(ZCJoinSplit& params,
const libzcash::SpendingKey& sk, CAmount value,
bool randomInputs) {
libzcash::JSOutput(sk.address(), value)
};
- boost::array<libzcash::Note, 2> output_notes;
+ boost::array<libzcash::SproutNote, 2> output_notes;
// Prepare JoinSplits
uint256 rt;
mtx.vjoinsplit.push_back(jsdesc);
// Empty output script.
+ uint32_t consensusBranchId = SPROUT_BRANCH_ID;
CScript scriptCode;
CTransaction signTx(mtx);
- uint256 dataToBeSigned = SignatureHash(scriptCode, signTx, NOT_AN_INPUT, SIGHASH_ALL);
+ uint256 dataToBeSigned = SignatureHash(scriptCode, signTx, NOT_AN_INPUT, SIGHASH_ALL, 0, consensusBranchId);
// Add the signature
assert(crypto_sign_detached(&mtx.joinSplitSig[0], NULL,
return wtx;
}
-libzcash::Note GetNote(ZCJoinSplit& params,
+libzcash::SproutNote GetNote(ZCJoinSplit& params,
const libzcash::SpendingKey& sk,
const CTransaction& tx, size_t js, size_t n) {
- ZCNoteDecryption decryptor {sk.viewing_key()};
+ ZCNoteDecryption decryptor {sk.receiving_key()};
auto hSig = tx.vjoinsplit[js].h_sig(params, tx.joinSplitPubKey);
auto note_pt = libzcash::NotePlaintext::decrypt(
decryptor,
CWalletTx GetValidSpend(ZCJoinSplit& params,
const libzcash::SpendingKey& sk,
- const libzcash::Note& note, CAmount value) {
+ const libzcash::SproutNote& note, CAmount value) {
CMutableTransaction mtx;
mtx.vout.resize(2);
mtx.vout[0].nValue = value;
libzcash::JSInput dummyin;
{
- if (note.value > value) {
+ if (note.value() > value) {
libzcash::SpendingKey dummykey = libzcash::SpendingKey::random();
libzcash::PaymentAddress dummyaddr = dummykey.address();
- dummyout = libzcash::JSOutput(dummyaddr, note.value - value);
- } else if (note.value < value) {
+ dummyout = libzcash::JSOutput(dummyaddr, note.value() - value);
+ } else if (note.value() < value) {
libzcash::SpendingKey dummykey = libzcash::SpendingKey::random();
libzcash::PaymentAddress dummyaddr = dummykey.address();
- libzcash::Note dummynote(dummyaddr.a_pk, (value - note.value), uint256(), uint256());
+ libzcash::SproutNote dummynote(dummyaddr.a_pk, (value - note.value()), uint256(), uint256());
tree.append(dummynote.cm());
dummyin = libzcash::JSInput(tree.witness(), dummynote, dummykey);
}
libzcash::JSOutput() // dummy output
};
- boost::array<libzcash::Note, 2> output_notes;
+ boost::array<libzcash::SproutNote, 2> output_notes;
// Prepare JoinSplits
uint256 rt = tree.root();
mtx.vjoinsplit.push_back(jsdesc);
// Empty output script.
+ uint32_t consensusBranchId = SPROUT_BRANCH_ID;
CScript scriptCode;
CTransaction signTx(mtx);
- uint256 dataToBeSigned = SignatureHash(scriptCode, signTx, NOT_AN_INPUT, SIGHASH_ALL);
+ uint256 dataToBeSigned = SignatureHash(scriptCode, signTx, NOT_AN_INPUT, SIGHASH_ALL, 0, consensusBranchId);
// Add the signature
assert(crypto_sign_detached(&mtx.joinSplitSig[0], NULL,