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

This commit is contained in:
Simon
2018-05-09 21:52:33 -07:00
parent 9e5398686c
commit 67f3577239
2 changed files with 5 additions and 1 deletions

View File

@@ -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;

View File

@@ -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 {