Change ciphertext length to match protocol spec, and refactor the use of constants.
This commit is contained in:
@@ -35,8 +35,8 @@ boost::array<uint256, N> unsigned_char_vector_array_to_uint256_array(const boost
|
||||
CPourTx::CPourTx(ZerocashParams& params,
|
||||
const CScript& scriptPubKey,
|
||||
const uint256& anchor,
|
||||
const boost::array<PourInput, NUM_POUR_INPUTS>& inputs,
|
||||
const boost::array<PourOutput, NUM_POUR_OUTPUTS>& outputs,
|
||||
const boost::array<PourInput, ZC_NUM_JS_INPUTS>& inputs,
|
||||
const boost::array<PourOutput, ZC_NUM_JS_OUTPUTS>& outputs,
|
||||
CAmount vpub_old,
|
||||
CAmount vpub_new) : scriptSig(), scriptPubKey(scriptPubKey), vpub_old(vpub_old), vpub_new(vpub_new), anchor(anchor)
|
||||
{
|
||||
@@ -55,9 +55,9 @@ CPourTx::CPourTx(ZerocashParams& params,
|
||||
vpub_old,
|
||||
vpub_new);
|
||||
|
||||
boost::array<std::vector<unsigned char>, NUM_POUR_INPUTS> serials_bv;
|
||||
boost::array<std::vector<unsigned char>, NUM_POUR_OUTPUTS> commitments_bv;
|
||||
boost::array<std::vector<unsigned char>, NUM_POUR_INPUTS> macs_bv;
|
||||
boost::array<std::vector<unsigned char>, ZC_NUM_JS_INPUTS> serials_bv;
|
||||
boost::array<std::vector<unsigned char>, ZC_NUM_JS_OUTPUTS> commitments_bv;
|
||||
boost::array<std::vector<unsigned char>, ZC_NUM_JS_INPUTS> macs_bv;
|
||||
|
||||
proof = pourtx.unpack(serials_bv, commitments_bv, macs_bv, ciphertexts, ephemeralKey);
|
||||
serials = unsigned_char_vector_array_to_uint256_array(serials_bv);
|
||||
@@ -80,9 +80,9 @@ bool CPourTx::Verify(ZerocashParams& params) const {
|
||||
std::vector<unsigned char>(anchor.begin(), anchor.end()),
|
||||
vpub_old,
|
||||
vpub_new,
|
||||
uint256_to_array<NUM_POUR_INPUTS>(serials),
|
||||
uint256_to_array<NUM_POUR_OUTPUTS>(commitments),
|
||||
uint256_to_array<NUM_POUR_INPUTS>(macs),
|
||||
uint256_to_array<ZC_NUM_JS_INPUTS>(serials),
|
||||
uint256_to_array<ZC_NUM_JS_OUTPUTS>(commitments),
|
||||
uint256_to_array<ZC_NUM_JS_INPUTS>(macs),
|
||||
proof
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,12 +18,10 @@
|
||||
#include "zerocash/PourOutput.h"
|
||||
|
||||
#include "zcash/NoteEncryption.hpp"
|
||||
#include "zcash/Zcash.h"
|
||||
|
||||
using namespace libzerocash;
|
||||
|
||||
static const unsigned int NUM_POUR_INPUTS = 2;
|
||||
static const unsigned int NUM_POUR_OUTPUTS = 2;
|
||||
|
||||
class CPourTx
|
||||
{
|
||||
public:
|
||||
@@ -50,20 +48,20 @@ public:
|
||||
// are derived from the secrets placed in the bucket
|
||||
// and the secret spend-authority key known by the
|
||||
// spender.
|
||||
boost::array<uint256, NUM_POUR_INPUTS> serials;
|
||||
boost::array<uint256, ZC_NUM_JS_INPUTS> serials;
|
||||
|
||||
// Bucket commitments are introduced into the commitment
|
||||
// tree, blinding the public about the values and
|
||||
// destinations involved in the Pour. The presence of a
|
||||
// commitment in the bucket commitment tree is required
|
||||
// to spend it.
|
||||
boost::array<uint256, NUM_POUR_OUTPUTS> commitments;
|
||||
boost::array<uint256, ZC_NUM_JS_OUTPUTS> commitments;
|
||||
|
||||
// Ciphertexts
|
||||
// These contain trapdoors, values and other information
|
||||
// that the recipient needs, including a memo field. It
|
||||
// is encrypted using the scheme implemented in crypto/NoteEncryption.cpp
|
||||
boost::array<ZCNoteEncryption::Ciphertext, NUM_POUR_OUTPUTS> ciphertexts;
|
||||
boost::array<ZCNoteEncryption::Ciphertext, ZC_NUM_JS_OUTPUTS> ciphertexts;
|
||||
|
||||
// Ephemeral key
|
||||
uint256 ephemeralKey;
|
||||
@@ -71,7 +69,7 @@ public:
|
||||
// MACs
|
||||
// The verification of the pour requires these MACs
|
||||
// to be provided as an input.
|
||||
boost::array<uint256, NUM_POUR_INPUTS> macs;
|
||||
boost::array<uint256, ZC_NUM_JS_INPUTS> macs;
|
||||
|
||||
// Pour proof
|
||||
// This is a zk-SNARK which ensures that this pour is valid.
|
||||
@@ -82,8 +80,8 @@ public:
|
||||
CPourTx(ZerocashParams& params,
|
||||
const CScript& scriptPubKey,
|
||||
const uint256& rt,
|
||||
const boost::array<PourInput, NUM_POUR_INPUTS>& inputs,
|
||||
const boost::array<PourOutput, NUM_POUR_OUTPUTS>& outputs,
|
||||
const boost::array<PourInput, ZC_NUM_JS_INPUTS>& inputs,
|
||||
const boost::array<PourOutput, ZC_NUM_JS_OUTPUTS>& outputs,
|
||||
CAmount vpub_old,
|
||||
CAmount vpub_new
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user