From d74379af303ececb66fa4c80ba373f99c7ac87b6 Mon Sep 17 00:00:00 2001 From: woodser Date: Tue, 2 Jul 2019 07:58:47 -0400 Subject: [PATCH] testSave() passing; implement setRestoreHeight(), save(), moveTo() stack --- src/wallet/MoneroWallet.cpp | 17 ++++++++--------- src/wallet/MoneroWallet.h | 15 +++++++-------- todo.txt | 3 ++- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index 7c4dc90..9bbbf04 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -651,6 +651,10 @@ namespace monero { return wallet2->get_refresh_from_block_height(); } + void MoneroWallet::setRestoreHeight(uint64_t restoreHeight) { + wallet2->set_refresh_from_block_height(restoreHeight); + } + uint64_t MoneroWallet::getBalance() const { return wallet2->balance_all(); } @@ -1329,17 +1333,12 @@ namespace monero { void MoneroWallet::save() { cout << "save()" << endl; - save("", ""); + wallet2->store(); } - void MoneroWallet::save(string path, string password) { - cout << "save(" << path << ", " << password << ")" << endl; - if (path.empty()) { - if (wallet2->get_wallet_file().empty()) throw runtime_error("Must specify path to save wallet because wallet has not been previously saved"); - else wallet2->store(); - } else { - wallet2->store_to(path, password); - } + void MoneroWallet::moveTo(string path, string password) { + cout << "moveTo(" << path << ", " << password << ")" << endl; + wallet2->store_to(path, password); } void MoneroWallet::close() { diff --git a/src/wallet/MoneroWallet.h b/src/wallet/MoneroWallet.h index bdfae00..6848f46 100644 --- a/src/wallet/MoneroWallet.h +++ b/src/wallet/MoneroWallet.h @@ -297,6 +297,8 @@ namespace monero { uint64_t getRestoreHeight() const; + void setRestoreHeight(uint64_t restoreHeight); + // // /** // * Indicates if importing multisig data is needed for returning a correct balance. @@ -1043,20 +1045,17 @@ namespace monero { // public void stopMining(); /** - * Re-save the wallet at its current path. - * - * Throws an exception if the wallet was not loaded from a path and has not - * been saved to an explicit path. + * Save the wallet at its current path. */ void save(); /** - * Save the wallet at the given path. + * Move the wallet from its current path to the given path. * - * @param path is the path to save the wallet at - * @param password is the password to encrypt the wallet + * @param path is the new wallet's path + * @param password is the new wallet's password // TODO: can this be used to change wallet password? */ - void save(string path, string password); + void moveTo(string path, string password); /** * Close the wallet. diff --git a/todo.txt b/todo.txt index 4bd2b97..d68fba0 100644 --- a/todo.txt +++ b/todo.txt @@ -4,7 +4,8 @@ cannot reconcile integrals on getTransfers() test, need to add reconcile debug i re-usable debug trace statements DaemonConnection is its own object onSyncProgress(startHeight, currentHeight, endHeight, percentDone, message)? - +remove warning jstring2string +comb code todos mergeTx(), model members are private, use accessors and mutators, return this for chaining use gnu debugger and sanitize=on further automate build process