Formatting

This commit is contained in:
Jack Grigg
2018-07-27 09:49:43 +02:00
parent e5dc5228ea
commit 25bb05de23
3 changed files with 32 additions and 38 deletions

View File

@@ -14,15 +14,14 @@ SpendDescriptionInfo::SpendDescriptionInfo(
libzcash::SaplingExpandedSpendingKey xsk,
libzcash::SaplingNote note,
uint256 anchor,
ZCSaplingIncrementalWitness witness
) : xsk(xsk), note(note), anchor(anchor), witness(witness)
ZCSaplingIncrementalWitness witness) : xsk(xsk), note(note), anchor(anchor), witness(witness)
{
librustzcash_sapling_generate_r(alpha.begin());
}
TransactionBuilder::TransactionBuilder(
const Consensus::Params& consensusParams, int nHeight
) : consensusParams(consensusParams), nHeight(nHeight)
const Consensus::Params& consensusParams,
int nHeight) : consensusParams(consensusParams), nHeight(nHeight)
{
mtx = CreateNewContextualCMutableTransaction(consensusParams, nHeight);
}
@@ -49,8 +48,8 @@ void TransactionBuilder::AddSaplingOutput(
libzcash::SaplingFullViewingKey from,
libzcash::SaplingPaymentAddress to,
CAmount value,
std::array<unsigned char, ZC_MEMO_SIZE> memo
) {
std::array<unsigned char, ZC_MEMO_SIZE> memo)
{
auto note = libzcash::SaplingNote(to, value);
outputs.emplace_back(from.ovk, note, memo);
mtx.valueBalance -= value;
@@ -76,19 +75,18 @@ boost::optional<CTransaction> TransactionBuilder::Build()
SpendDescription sdesc;
if (!librustzcash_sapling_spend_proof(
ctx,
spend.xsk.full_viewing_key().ak.begin(),
spend.xsk.nsk.begin(),
spend.note.d.data(),
spend.note.r.begin(),
spend.alpha.begin(),
spend.note.value(),
spend.anchor.begin(),
witness.data(),
sdesc.cv.begin(),
sdesc.rk.begin(),
sdesc.zkproof.data()
)) {
ctx,
spend.xsk.full_viewing_key().ak.begin(),
spend.xsk.nsk.begin(),
spend.note.d.data(),
spend.note.r.begin(),
spend.alpha.begin(),
spend.note.value(),
spend.anchor.begin(),
witness.data(),
sdesc.cv.begin(),
sdesc.rk.begin(),
sdesc.zkproof.data())) {
librustzcash_sapling_proving_ctx_free(ctx);
return boost::none;
}
@@ -118,15 +116,14 @@ boost::optional<CTransaction> TransactionBuilder::Build()
OutputDescription odesc;
if (!librustzcash_sapling_output_proof(
ctx,
encryptor.get_esk().begin(),
output.note.d.data(),
output.note.pk_d.begin(),
output.note.r.begin(),
output.note.value(),
odesc.cv.begin(),
odesc.zkproof.begin()
)) {
ctx,
encryptor.get_esk().begin(),
output.note.d.data(),
output.note.pk_d.begin(),
output.note.r.begin(),
output.note.value(),
odesc.cv.begin(),
odesc.zkproof.begin())) {
librustzcash_sapling_proving_ctx_free(ctx);
return boost::none;
}
@@ -140,8 +137,7 @@ boost::optional<CTransaction> TransactionBuilder::Build()
output.ovk,
odesc.cv,
odesc.cm,
encryptor
);
encryptor);
mtx.vShieldedOutput.push_back(odesc);
}