Browse Source

Closes #3250. Memo getter should return by reference, not by value.

pull/4/head
Simon 6 years ago
parent
commit
67f3577239
  1. 4
      src/gtest/test_joinsplit.cpp
  2. 2
      src/zcash/Note.hpp

4
src/gtest/test_joinsplit.cpp

@ -550,6 +550,10 @@ TEST(joinsplit, note_plaintexts)
ASSERT_TRUE(decrypted.memo() == note_pt.memo());
// Check memo() returns by reference, not return by value, for use cases such as:
// std::string data(plaintext.memo().begin(), plaintext.memo().end());
ASSERT_TRUE(decrypted.memo().data() == decrypted.memo().data());
// Check serialization of note plaintext
CDataStream ss(SER_DISK, PROTOCOL_VERSION);
ss << note_pt;

2
src/zcash/Note.hpp

@ -49,7 +49,7 @@ public:
virtual ~BaseNotePlaintext() {}
inline uint64_t value() const { return value_; }
inline boost::array<unsigned char, ZC_MEMO_SIZE> memo() const { return memo_; }
inline const boost::array<unsigned char, ZC_MEMO_SIZE> & memo() const { return memo_; }
};
class SproutNotePlaintext : public BaseNotePlaintext {

Loading…
Cancel
Save