Sign JoinSplit transactions

This commit is contained in:
Taylor Hornby
2016-05-24 15:33:41 -06:00
parent fd7c139e37
commit 6aae9d1a55
6 changed files with 132 additions and 22 deletions

View File

@@ -14,6 +14,8 @@
#include "script/script.h"
#include "uint256.h"
#include "sodium.h"
using namespace std;
typedef vector<unsigned char> valtype;
@@ -1030,6 +1032,7 @@ public:
// Serialize the prevout
::Serialize(s, txTo.vin[nInput].prevout, nType, nVersion);
// Serialize the script
assert(nInput != NOT_AN_INPUT);
if (nInput != nIn)
// Blank out other inputs' signatures
::Serialize(s, CScript(), nType, nVersion);
@@ -1073,22 +1076,14 @@ public:
// Serialize vpour
if (txTo.nVersion >= 2) {
// TODO:
//
// SIGHASH_* functions will hash portions of
// the transaction for use in signatures. This
// keeps the pour cryptographically bound to
// the transaction from the perspective of the
// inputs (but not from the perspective of the
// pour).
// keeps the JoinSplit cryptographically bound
// to the transaction.
//
// This must be rectified in the future.
// See zcash/#529
//
// It will be necessary to change this API to
// be abstract over whether an input script is
// being skipped or a pour is being skipped.
::Serialize(s, txTo.vpour, nType, nVersion);
::Serialize(s, txTo.joinSplitPubKey, nType, nVersion);
}
}
};