Implement basic Sapling v4 transaction parser
Details of Sapling datatypes will be filled in later; for now, they are treated
as binary blobs.
Includes code cherry-picked from upstream commit:
7030d9eb47254499bba14f1c00abc6bf493efd91
BIP144: Serialization, hashes, relay (sender side)
This commit is contained in:
@@ -57,6 +57,7 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fInclud
|
||||
|
||||
|
||||
UniValue TxJoinSplitToJSON(const CTransaction& tx) {
|
||||
bool useGroth = tx.fOverwintered && tx.nVersion >= SAPLING_TX_VERSION;
|
||||
UniValue vjoinsplit(UniValue::VARR);
|
||||
for (unsigned int i = 0; i < tx.vjoinsplit.size(); i++) {
|
||||
const JSDescription& jsdescription = tx.vjoinsplit[i];
|
||||
@@ -95,7 +96,8 @@ UniValue TxJoinSplitToJSON(const CTransaction& tx) {
|
||||
}
|
||||
|
||||
CDataStream ssProof(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ssProof << jsdescription.proof;
|
||||
auto ps = SproutProofSerializer<CDataStream>(ssProof, useGroth);
|
||||
boost::apply_visitor(ps, jsdescription.proof);
|
||||
joinsplit.push_back(Pair("proof", HexStr(ssProof.begin(), ssProof.end())));
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user