testSave() passing;

implement setRestoreHeight(), save(), moveTo() stack
This commit is contained in:
woodser
2019-07-02 07:58:47 -04:00
parent 42dc9cda4a
commit d74379af30
3 changed files with 17 additions and 18 deletions
+8 -9
View File
@@ -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() {
+7 -8
View File
@@ -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.