Wallet API: add some missing override keyword

Also remove dust() from UnsignedTransactionImpl (already in PendingTransactionImpl)
This commit is contained in:
stoffu 2018-06-14 08:22:30 +09:00
parent 2329d2f4c8
commit 4510f417f9
No known key found for this signature in database
GPG Key ID: 41DAB8343A9EC012
7 changed files with 162 additions and 163 deletions

View File

@ -42,16 +42,16 @@ public:
~AddressBookImpl(); ~AddressBookImpl();
// Fetches addresses from Wallet2 // Fetches addresses from Wallet2
void refresh(); void refresh() override;
std::vector<AddressBookRow*> getAll() const; std::vector<AddressBookRow*> getAll() const override;
bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description); bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) override;
bool deleteRow(std::size_t rowId); bool deleteRow(std::size_t rowId) override;
// Error codes. See AddressBook:ErrorCode enum in wallet2_api.h // Error codes. See AddressBook:ErrorCode enum in wallet2_api.h
std::string errorString() const {return m_errorString;} std::string errorString() const override {return m_errorString;}
int errorCode() const {return m_errorCode;} int errorCode() const override {return m_errorCode;}
int lookupPaymentID(const std::string &payment_id) const; int lookupPaymentID(const std::string &payment_id) const override;
private: private:
void clearRows(); void clearRows();

View File

@ -43,21 +43,21 @@ class PendingTransactionImpl : public PendingTransaction
public: public:
PendingTransactionImpl(WalletImpl &wallet); PendingTransactionImpl(WalletImpl &wallet);
~PendingTransactionImpl(); ~PendingTransactionImpl();
int status() const; int status() const override;
std::string errorString() const; std::string errorString() const override;
bool commit(const std::string &filename = "", bool overwrite = false); bool commit(const std::string &filename = "", bool overwrite = false) override;
uint64_t amount() const; uint64_t amount() const override;
uint64_t dust() const; uint64_t dust() const override;
uint64_t fee() const; uint64_t fee() const override;
std::vector<std::string> txid() const; std::vector<std::string> txid() const override;
uint64_t txCount() const; uint64_t txCount() const override;
std::vector<uint32_t> subaddrAccount() const; std::vector<uint32_t> subaddrAccount() const override;
std::vector<std::set<uint32_t>> subaddrIndices() const; std::vector<std::set<uint32_t>> subaddrIndices() const override;
// TODO: continue with interface; // TODO: continue with interface;
std::string multisigSignData(); std::string multisigSignData() override;
void signMultisigTx(); void signMultisigTx() override;
std::vector<std::string> signersKeys() const; std::vector<std::string> signersKeys() const override;
private: private:
friend class WalletImpl; friend class WalletImpl;

View File

@ -40,10 +40,10 @@ public:
~SubaddressImpl(); ~SubaddressImpl();
// Fetches addresses from Wallet2 // Fetches addresses from Wallet2
void refresh(uint32_t accountIndex); void refresh(uint32_t accountIndex) override;
std::vector<SubaddressRow*> getAll() const; std::vector<SubaddressRow*> getAll() const override;
void addRow(uint32_t accountIndex, const std::string &label); void addRow(uint32_t accountIndex, const std::string &label) override;
void setLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label); void setLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) override;
private: private:
void clearRows(); void clearRows();

View File

@ -42,24 +42,24 @@ public:
TransactionInfoImpl(); TransactionInfoImpl();
~TransactionInfoImpl(); ~TransactionInfoImpl();
//! in/out //! in/out
virtual int direction() const; virtual int direction() const override;
//! true if hold //! true if hold
virtual bool isPending() const; virtual bool isPending() const override;
virtual bool isFailed() const; virtual bool isFailed() const override;
virtual uint64_t amount() const; virtual uint64_t amount() const override;
//! always 0 for incoming txes //! always 0 for incoming txes
virtual uint64_t fee() const; virtual uint64_t fee() const override;
virtual uint64_t blockHeight() const; virtual uint64_t blockHeight() const override;
virtual std::set<uint32_t> subaddrIndex() const; virtual std::set<uint32_t> subaddrIndex() const override;
virtual uint32_t subaddrAccount() const; virtual uint32_t subaddrAccount() const override;
virtual std::string label() const; virtual std::string label() const override;
virtual std::string hash() const; virtual std::string hash() const override;
virtual std::time_t timestamp() const; virtual std::time_t timestamp() const override;
virtual std::string paymentId() const; virtual std::string paymentId() const override;
virtual const std::vector<Transfer> &transfers() const; virtual const std::vector<Transfer> &transfers() const override;
virtual uint64_t confirmations() const; virtual uint64_t confirmations() const override;
virtual uint64_t unlockTime() const; virtual uint64_t unlockTime() const override;
private: private:
int m_direction; int m_direction;

View File

@ -43,19 +43,18 @@ class UnsignedTransactionImpl : public UnsignedTransaction
public: public:
UnsignedTransactionImpl(WalletImpl &wallet); UnsignedTransactionImpl(WalletImpl &wallet);
~UnsignedTransactionImpl(); ~UnsignedTransactionImpl();
int status() const; int status() const override;
std::string errorString() const; std::string errorString() const override;
std::vector<uint64_t> amount() const; std::vector<uint64_t> amount() const override;
std::vector<uint64_t> dust() const; std::vector<uint64_t> fee() const override;
std::vector<uint64_t> fee() const; std::vector<uint64_t> mixin() const override;
std::vector<uint64_t> mixin() const; std::vector<std::string> paymentId() const override;
std::vector<std::string> paymentId() const; std::vector<std::string> recipientAddress() const override;
std::vector<std::string> recipientAddress() const; uint64_t txCount() const override;
uint64_t txCount() const;
// sign txs and save to file // sign txs and save to file
bool sign(const std::string &signedFileName); bool sign(const std::string &signedFileName) override;
std::string confirmationMessage() const {return m_confirmationMessage;} std::string confirmationMessage() const override {return m_confirmationMessage;}
uint64_t minMixinCount() const; uint64_t minMixinCount() const override;
private: private:
// Callback function to check all loaded tx's and generate confirmationMessage // Callback function to check all loaded tx's and generate confirmationMessage

View File

@ -57,7 +57,7 @@ public:
bool create(const std::string &path, const std::string &password, bool create(const std::string &path, const std::string &password,
const std::string &language); const std::string &language);
bool createWatchOnly(const std::string &path, const std::string &password, bool createWatchOnly(const std::string &path, const std::string &password,
const std::string &language) const; const std::string &language) const override;
bool open(const std::string &path, const std::string &password); bool open(const std::string &path, const std::string &password);
bool recover(const std::string &path,const std::string &password, bool recover(const std::string &path,const std::string &password,
const std::string &seed); const std::string &seed);
@ -80,58 +80,58 @@ public:
const std::string &password, const std::string &password,
const std::string &device_name); const std::string &device_name);
bool close(bool store = true); bool close(bool store = true);
std::string seed() const; std::string seed() const override;
std::string getSeedLanguage() const; std::string getSeedLanguage() const override;
void setSeedLanguage(const std::string &arg); void setSeedLanguage(const std::string &arg) override;
// void setListener(Listener *) {} // void setListener(Listener *) {}
int status() const; int status() const override;
std::string errorString() const; std::string errorString() const override;
void statusWithErrorString(int& status, std::string& errorString) const override; void statusWithErrorString(int& status, std::string& errorString) const override;
bool setPassword(const std::string &password); bool setPassword(const std::string &password) override;
std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const; std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const override;
std::string integratedAddress(const std::string &payment_id) const; std::string integratedAddress(const std::string &payment_id) const override;
std::string secretViewKey() const; std::string secretViewKey() const override;
std::string publicViewKey() const; std::string publicViewKey() const override;
std::string secretSpendKey() const; std::string secretSpendKey() const override;
std::string publicSpendKey() const; std::string publicSpendKey() const override;
std::string publicMultisigSignerKey() const; std::string publicMultisigSignerKey() const override;
std::string path() const; std::string path() const override;
bool store(const std::string &path); bool store(const std::string &path) override;
std::string filename() const; std::string filename() const override;
std::string keysFilename() const; std::string keysFilename() const override;
bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit = 0, const std::string &daemon_username = "", const std::string &daemon_password = "", bool use_ssl = false, bool lightWallet = false); bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit = 0, const std::string &daemon_username = "", const std::string &daemon_password = "", bool use_ssl = false, bool lightWallet = false) override;
bool connectToDaemon(); bool connectToDaemon() override;
ConnectionStatus connected() const; ConnectionStatus connected() const override;
void setTrustedDaemon(bool arg); void setTrustedDaemon(bool arg) override;
bool trustedDaemon() const; bool trustedDaemon() const override;
uint64_t balance(uint32_t accountIndex = 0) const; uint64_t balance(uint32_t accountIndex = 0) const override;
uint64_t unlockedBalance(uint32_t accountIndex = 0) const; uint64_t unlockedBalance(uint32_t accountIndex = 0) const override;
uint64_t blockChainHeight() const; uint64_t blockChainHeight() const override;
uint64_t approximateBlockChainHeight() const; uint64_t approximateBlockChainHeight() const override;
uint64_t daemonBlockChainHeight() const; uint64_t daemonBlockChainHeight() const override;
uint64_t daemonBlockChainTargetHeight() const; uint64_t daemonBlockChainTargetHeight() const override;
bool synchronized() const; bool synchronized() const override;
bool refresh(); bool refresh() override;
void refreshAsync(); void refreshAsync() override;
void setAutoRefreshInterval(int millis); void setAutoRefreshInterval(int millis) override;
int autoRefreshInterval() const; int autoRefreshInterval() const override;
void setRefreshFromBlockHeight(uint64_t refresh_from_block_height); void setRefreshFromBlockHeight(uint64_t refresh_from_block_height) override;
uint64_t getRefreshFromBlockHeight() const { return m_wallet->get_refresh_from_block_height(); }; uint64_t getRefreshFromBlockHeight() const override { return m_wallet->get_refresh_from_block_height(); };
void setRecoveringFromSeed(bool recoveringFromSeed); void setRecoveringFromSeed(bool recoveringFromSeed) override;
void setRecoveringFromDevice(bool recoveringFromDevice) override; void setRecoveringFromDevice(bool recoveringFromDevice) override;
void setSubaddressLookahead(uint32_t major, uint32_t minor) override; void setSubaddressLookahead(uint32_t major, uint32_t minor) override;
bool watchOnly() const; bool watchOnly() const override;
bool rescanSpent(); bool rescanSpent() override;
NetworkType nettype() const {return static_cast<NetworkType>(m_wallet->nettype());} NetworkType nettype() const override {return static_cast<NetworkType>(m_wallet->nettype());}
void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const; void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const override;
bool useForkRules(uint8_t version, int64_t early_blocks) const; bool useForkRules(uint8_t version, int64_t early_blocks) const override;
void addSubaddressAccount(const std::string& label); void addSubaddressAccount(const std::string& label) override;
size_t numSubaddressAccounts() const; size_t numSubaddressAccounts() const override;
size_t numSubaddresses(uint32_t accountIndex) const; size_t numSubaddresses(uint32_t accountIndex) const override;
void addSubaddress(uint32_t accountIndex, const std::string& label); void addSubaddress(uint32_t accountIndex, const std::string& label) override;
std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const; std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const override;
void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label); void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) override;
MultisigState multisig() const override; MultisigState multisig() const override;
std::string getMultisigInfo() const override; std::string getMultisigInfo() const override;
@ -145,49 +145,49 @@ public:
optional<uint64_t> amount, uint32_t mixin_count, optional<uint64_t> amount, uint32_t mixin_count,
PendingTransaction::Priority priority = PendingTransaction::Priority_Low, PendingTransaction::Priority priority = PendingTransaction::Priority_Low,
uint32_t subaddr_account = 0, uint32_t subaddr_account = 0,
std::set<uint32_t> subaddr_indices = {}); std::set<uint32_t> subaddr_indices = {}) override;
virtual PendingTransaction * createSweepUnmixableTransaction(); virtual PendingTransaction * createSweepUnmixableTransaction() override;
bool submitTransaction(const std::string &fileName); bool submitTransaction(const std::string &fileName) override;
virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename); virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) override;
bool exportKeyImages(const std::string &filename); bool exportKeyImages(const std::string &filename) override;
bool importKeyImages(const std::string &filename); bool importKeyImages(const std::string &filename) override;
virtual void disposeTransaction(PendingTransaction * t); virtual void disposeTransaction(PendingTransaction * t) override;
virtual TransactionHistory * history(); virtual TransactionHistory * history() override;
virtual AddressBook * addressBook(); virtual AddressBook * addressBook() override;
virtual Subaddress * subaddress(); virtual Subaddress * subaddress() override;
virtual SubaddressAccount * subaddressAccount(); virtual SubaddressAccount * subaddressAccount() override;
virtual void setListener(WalletListener * l); virtual void setListener(WalletListener * l) override;
virtual uint32_t defaultMixin() const; virtual uint32_t defaultMixin() const override;
virtual void setDefaultMixin(uint32_t arg); virtual void setDefaultMixin(uint32_t arg) override;
virtual bool setUserNote(const std::string &txid, const std::string &note); virtual bool setUserNote(const std::string &txid, const std::string &note) override;
virtual std::string getUserNote(const std::string &txid) const; virtual std::string getUserNote(const std::string &txid) const override;
virtual std::string getTxKey(const std::string &txid) const; virtual std::string getTxKey(const std::string &txid) const override;
virtual bool checkTxKey(const std::string &txid, std::string tx_key, const std::string &address, uint64_t &received, bool &in_pool, uint64_t &confirmations); virtual bool checkTxKey(const std::string &txid, std::string tx_key, const std::string &address, uint64_t &received, bool &in_pool, uint64_t &confirmations) override;
virtual std::string getTxProof(const std::string &txid, const std::string &address, const std::string &message) const; virtual std::string getTxProof(const std::string &txid, const std::string &address, const std::string &message) const override;
virtual bool checkTxProof(const std::string &txid, const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &received, bool &in_pool, uint64_t &confirmations); virtual bool checkTxProof(const std::string &txid, const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &received, bool &in_pool, uint64_t &confirmations) override;
virtual std::string getSpendProof(const std::string &txid, const std::string &message) const; virtual std::string getSpendProof(const std::string &txid, const std::string &message) const override;
virtual bool checkSpendProof(const std::string &txid, const std::string &message, const std::string &signature, bool &good) const; virtual bool checkSpendProof(const std::string &txid, const std::string &message, const std::string &signature, bool &good) const override;
virtual std::string getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const; virtual std::string getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const override;
virtual bool checkReserveProof(const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &total, uint64_t &spent) const; virtual bool checkReserveProof(const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &total, uint64_t &spent) const override;
virtual std::string signMessage(const std::string &message); virtual std::string signMessage(const std::string &message) override;
virtual bool verifySignedMessage(const std::string &message, const std::string &address, const std::string &signature) const; virtual bool verifySignedMessage(const std::string &message, const std::string &address, const std::string &signature) const override;
virtual std::string signMultisigParticipant(const std::string &message) const; virtual std::string signMultisigParticipant(const std::string &message) const override;
virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const; virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const override;
virtual void startRefresh(); virtual void startRefresh() override;
virtual void pauseRefresh(); virtual void pauseRefresh() override;
virtual bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error); virtual bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error) override;
virtual std::string getDefaultDataDir() const; virtual std::string getDefaultDataDir() const override;
virtual bool lightWalletLogin(bool &isNewWallet) const; virtual bool lightWalletLogin(bool &isNewWallet) const override;
virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status); virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) override;
virtual bool blackballOutputs(const std::vector<std::string> &pubkeys, bool add); virtual bool blackballOutputs(const std::vector<std::string> &pubkeys, bool add) override;
virtual bool unblackballOutput(const std::string &pubkey); virtual bool unblackballOutput(const std::string &pubkey) override;
virtual bool getRing(const std::string &key_image, std::vector<uint64_t> &ring) const; virtual bool getRing(const std::string &key_image, std::vector<uint64_t> &ring) const override;
virtual bool getRings(const std::string &txid, std::vector<std::pair<std::string, std::vector<uint64_t>>> &rings) const; virtual bool getRings(const std::string &txid, std::vector<std::pair<std::string, std::vector<uint64_t>>> &rings) const override;
virtual bool setRing(const std::string &key_image, const std::vector<uint64_t> &ring, bool relative); virtual bool setRing(const std::string &key_image, const std::vector<uint64_t> &ring, bool relative) override;
virtual void segregatePreForkOutputs(bool segregate); virtual void segregatePreForkOutputs(bool segregate) override;
virtual void segregationHeight(uint64_t height); virtual void segregationHeight(uint64_t height) override;
virtual void keyReuseMitigation2(bool mitigation); virtual void keyReuseMitigation2(bool mitigation) override;
private: private:
void clearStatus() const; void clearStatus() const;

View File

@ -39,13 +39,13 @@ class WalletManagerImpl : public WalletManager
{ {
public: public:
Wallet * createWallet(const std::string &path, const std::string &password, Wallet * createWallet(const std::string &path, const std::string &password,
const std::string &language, NetworkType nettype); const std::string &language, NetworkType nettype) override;
Wallet * openWallet(const std::string &path, const std::string &password, NetworkType nettype); Wallet * openWallet(const std::string &path, const std::string &password, NetworkType nettype) override;
virtual Wallet * recoveryWallet(const std::string &path, virtual Wallet * recoveryWallet(const std::string &path,
const std::string &password, const std::string &password,
const std::string &mnemonic, const std::string &mnemonic,
NetworkType nettype, NetworkType nettype,
uint64_t restoreHeight); uint64_t restoreHeight) override;
virtual Wallet * createWalletFromKeys(const std::string &path, virtual Wallet * createWalletFromKeys(const std::string &path,
const std::string &password, const std::string &password,
const std::string &language, const std::string &language,
@ -53,9 +53,9 @@ public:
uint64_t restoreHeight, uint64_t restoreHeight,
const std::string &addressString, const std::string &addressString,
const std::string &viewKeyString, const std::string &viewKeyString,
const std::string &spendKeyString = ""); const std::string &spendKeyString = "") override;
// next two methods are deprecated - use the above version which allow setting of a password // next two methods are deprecated - use the above version which allow setting of a password
virtual Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, NetworkType nettype, uint64_t restoreHeight); virtual Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, NetworkType nettype, uint64_t restoreHeight) override;
// deprecated: use createWalletFromKeys(..., password, ...) instead // deprecated: use createWalletFromKeys(..., password, ...) instead
virtual Wallet * createWalletFromKeys(const std::string &path, virtual Wallet * createWalletFromKeys(const std::string &path,
const std::string &language, const std::string &language,
@ -63,29 +63,29 @@ public:
uint64_t restoreHeight, uint64_t restoreHeight,
const std::string &addressString, const std::string &addressString,
const std::string &viewKeyString, const std::string &viewKeyString,
const std::string &spendKeyString = ""); const std::string &spendKeyString = "") override;
virtual Wallet * createWalletFromDevice(const std::string &path, virtual Wallet * createWalletFromDevice(const std::string &path,
const std::string &password, const std::string &password,
NetworkType nettype, NetworkType nettype,
const std::string &deviceName, const std::string &deviceName,
uint64_t restoreHeight = 0, uint64_t restoreHeight = 0,
const std::string &subaddressLookahead = "") override; const std::string &subaddressLookahead = "") override;
virtual bool closeWallet(Wallet *wallet, bool store = true); virtual bool closeWallet(Wallet *wallet, bool store = true) override;
bool walletExists(const std::string &path); bool walletExists(const std::string &path) override;
bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key) const; bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key) const override;
std::vector<std::string> findWallets(const std::string &path); std::vector<std::string> findWallets(const std::string &path) override;
std::string errorString() const; std::string errorString() const override;
void setDaemonAddress(const std::string &address); void setDaemonAddress(const std::string &address) override;
bool connected(uint32_t *version = NULL); bool connected(uint32_t *version = NULL) override;
uint64_t blockchainHeight(); uint64_t blockchainHeight() override;
uint64_t blockchainTargetHeight(); uint64_t blockchainTargetHeight() override;
uint64_t networkDifficulty(); uint64_t networkDifficulty() override;
double miningHashRate(); double miningHashRate() override;
uint64_t blockTarget(); uint64_t blockTarget() override;
bool isMining(); bool isMining() override;
bool startMining(const std::string &address, uint32_t threads = 1, bool background_mining = false, bool ignore_battery = true); bool startMining(const std::string &address, uint32_t threads = 1, bool background_mining = false, bool ignore_battery = true) override;
bool stopMining(); bool stopMining() override;
std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const; std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const override;
private: private:
WalletManagerImpl() {} WalletManagerImpl() {}