From 4eb1a96f9ad140d3f3899dadbd405a630b012c25 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 20 Aug 2016 19:53:35 -0700 Subject: [PATCH] Add public field 'memo' to JSOutput to enable creation of notes with custom memos. --- src/zcash/JoinSplit.cpp | 5 +---- src/zcash/JoinSplit.hpp | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/zcash/JoinSplit.cpp b/src/zcash/JoinSplit.cpp index acec69e0e..719564523 100644 --- a/src/zcash/JoinSplit.cpp +++ b/src/zcash/JoinSplit.cpp @@ -214,11 +214,8 @@ public: ZCNoteEncryption encryptor(h_sig); for (size_t i = 0; i < NumOutputs; i++) { - // TODO: expose memo in the public interface - // 0xF6 is invalid UTF8 as per spec - boost::array memo = {{0xF6}}; - NotePlaintext pt(out_notes[i], memo); + NotePlaintext pt(out_notes[i], outputs[i].memo); out_ciphertexts[i] = pt.encrypt(encryptor, outputs[i].addr.pk_enc); } diff --git a/src/zcash/JoinSplit.hpp b/src/zcash/JoinSplit.hpp index df883bf95..6acfc2a25 100644 --- a/src/zcash/JoinSplit.hpp +++ b/src/zcash/JoinSplit.hpp @@ -35,6 +35,7 @@ class JSOutput { public: PaymentAddress addr; uint64_t value; + boost::array memo = {{0xF6}}; // 0xF6 is invalid UTF8 as per spec, rest of array is 0x00 JSOutput(); JSOutput(PaymentAddress addr, uint64_t value) : addr(addr), value(value) { }