implement importOutputsHex()

This commit is contained in:
woodser
2019-07-02 08:57:48 -04:00
parent bf9e2d516e
commit f28d7db26b
3 changed files with 21 additions and 8 deletions
+12
View File
@@ -1341,6 +1341,18 @@ namespace monero {
return epee::string_tools::buff_to_hex_nodelimer(wallet2->export_outputs_to_str(true));
}
int MoneroWallet::importOutputsHex(const string& outputsHex) {
// validate and parse hex data
cryptonote::blobdata blob;
if (!epee::string_tools::parse_hexstr_to_binbuff(outputsHex, blob)) {
throw runtime_error("Failed to parse hex.");
}
// import hex and return result
return wallet2->import_outputs_from_str(blob);
}
void MoneroWallet::save() {
cout << "save()" << endl;
wallet2->store();
+8 -8
View File
@@ -1006,14 +1006,14 @@ namespace monero {
*/
string getOutputsHex() const;
// /**
// * Import outputs in hex format.
// *
// * @param outputsHex are outputs in hex format
// * @return the number of outputs imported
// */
// public int importOutputsHex(string outputsHex);
//
/**
* Import outputs in hex format.
*
* @param outputsHex are outputs in hex format
* @return the number of outputs imported
*/
int importOutputsHex(const string& outputsHex);
// /**
// * Set an arbitrary attribute.
// *
+1
View File
@@ -1,3 +1,4 @@
handle e.g. restricted or hw wallet limitations in wallet_rpc_server, e.g. on_import_outputs?
wallet2 does not automatically save unlike rpc; where to invoke save and how to separate for tests?
throw MoneroErrors instead of runtime_errors
toPropertyTree() should take node as parameter; optimize memory elsewhere