Change transaction builder and miner to use v2 Sapling note plaintexts after Canopy activates.

Co-authored by Ying Tong (yingtong@electriccoin.co)
This commit is contained in:
Sean Bowe 2020-06-17 16:02:37 -06:00 committed by moss
parent 8770a5c532
commit bf9baf2cb6
2 changed files with 10 additions and 2 deletions

View File

@ -157,7 +157,11 @@ public:
mtx.valueBalance = -value;
uint256 ovk;
auto note = libzcash::SaplingNote(pa, value, 0x01); // TODO
unsigned char leadByte = 0x01;
if (Params().GetConsensus().NetworkUpgradeActive(nHeight, Consensus::UPGRADE_CANOPY)) {
leadByte = 0x02;
}
auto note = libzcash::SaplingNote(pa, value, leadByte);
auto output = OutputDescriptionInfo(ovk, note, {{0xF6}});
auto ctx = librustzcash_sapling_proving_ctx_init();

View File

@ -162,7 +162,11 @@ void TransactionBuilder::AddSaplingOutput(
throw std::runtime_error("TransactionBuilder cannot add Sapling output to pre-Sapling transaction");
}
auto note = libzcash::SaplingNote(to, value, 0x01); // TODO
unsigned char leadByte = 0x01;
if (Params().GetConsensus().NetworkUpgradeActive(nHeight, Consensus::UPGRADE_CANOPY)) {
leadByte = 0x02;
}
auto note = libzcash::SaplingNote(to, value, leadByte);
outputs.emplace_back(ovk, note, memo);
mtx.valueBalance -= value;
}