Closes #3250. Memo getter should return by reference, not by value.
This commit is contained in:
@@ -550,6 +550,10 @@ TEST(joinsplit, note_plaintexts)
|
|||||||
|
|
||||||
ASSERT_TRUE(decrypted.memo() == note_pt.memo());
|
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
|
// Check serialization of note plaintext
|
||||||
CDataStream ss(SER_DISK, PROTOCOL_VERSION);
|
CDataStream ss(SER_DISK, PROTOCOL_VERSION);
|
||||||
ss << note_pt;
|
ss << note_pt;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
virtual ~BaseNotePlaintext() {}
|
virtual ~BaseNotePlaintext() {}
|
||||||
|
|
||||||
inline uint64_t value() const { return value_; }
|
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 {
|
class SproutNotePlaintext : public BaseNotePlaintext {
|
||||||
|
|||||||
Reference in New Issue
Block a user