Refactoring: SproutNote member variable value moved to BaseNote.

All notes have a value, so the member variable has been moved to the
base class, and direct member access has been replaced with a getter.
This commit is contained in:
Simon
2018-04-25 13:32:13 -07:00
parent b230fe6836
commit 5d99e3e92f
11 changed files with 24 additions and 21 deletions

View File

@@ -9,19 +9,23 @@
namespace libzcash {
class BaseNote {
protected:
uint64_t value_ = 0;
public:
BaseNote() {}
BaseNote(uint64_t value) : value_(value) {};
virtual uint256 cm() const {};
inline uint64_t value() const { return value_; };
};
class SproutNote : public BaseNote {
public:
uint256 a_pk;
uint64_t value;
uint256 rho;
uint256 r;
SproutNote(uint256 a_pk, uint64_t value, uint256 rho, uint256 r)
: a_pk(a_pk), value(value), rho(rho), r(r) {}
: BaseNote(value), a_pk(a_pk), rho(rho), r(r) {}
SproutNote();