mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-18 23:58:59 +02:00
implement importOutputsHex()
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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,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
|
||||
|
||||
Reference in New Issue
Block a user