rename and support export_outputs(bool all=false), import_outputs()

This commit is contained in:
woodser
2021-03-07 11:56:40 -05:00
parent f765200b7b
commit b8198f5357
3 changed files with 13 additions and 12 deletions
+7 -6
View File
@@ -748,12 +748,13 @@ namespace monero {
}
/**
* Export all outputs in hex format.
* Export outputs in hex format.
*
* @return all outputs in hex format, empty std::string if no outputs
* @param all exports all outputs if true, else only the outputs since the last export
* @return outputs in hex format, empty std::string if no outputs
*/
virtual std::string get_outputs_hex() const {
throw std::runtime_error("get_outputs_hex() not supported");
virtual std::string export_outputs(bool all = false) const {
throw std::runtime_error("export_outputs() not supported");
}
/**
@@ -762,8 +763,8 @@ namespace monero {
* @param outputs_hex are outputs in hex format
* @return the number of outputs imported
*/
virtual int import_outputs_hex(const std::string& outputs_hex) {
throw std::runtime_error("import_outputs_hex() not supported");
virtual int import_outputs(const std::string& outputs_hex) {
throw std::runtime_error("import_outputs() not supported");
}
/**
+4 -4
View File
@@ -1652,18 +1652,18 @@ namespace monero {
// otherwise get txs with full models to fulfill query
std::vector<std::shared_ptr<monero_output_wallet>> outputs;
for (const std::shared_ptr<monero_tx_wallet>& tx : get_txs(*(query.m_tx_query.get()))) {
for (const std::shared_ptr<monero_output_wallet>& output : tx->filter_outputs_wallet(query)) { // collect queried outputs, erase if excluded
for (const std::shared_ptr<monero_output_wallet>& output : tx->filter_outputs_wallet(query)) { // collect queried outputs, erase if excluded
outputs.push_back(output);
}
}
return outputs;
}
std::string monero_wallet_full::get_outputs_hex() const {
return epee::string_tools::buff_to_hex_nodelimer(m_w2->export_outputs_to_str(true));
std::string monero_wallet_full::export_outputs(bool all) const {
return epee::string_tools::buff_to_hex_nodelimer(m_w2->export_outputs_to_str(all));
}
int monero_wallet_full::import_outputs_hex(const std::string& outputs_hex) {
int monero_wallet_full::import_outputs(const std::string& outputs_hex) {
// validate and parse hex data
cryptonote::blobdata blob;
+2 -2
View File
@@ -224,8 +224,8 @@ namespace monero {
std::vector<std::shared_ptr<monero_tx_wallet>> get_txs(const monero_tx_query& query, std::vector<std::string>& missing_tx_hashes) const override;
std::vector<std::shared_ptr<monero_transfer>> get_transfers(const monero_transfer_query& query) const override;
std::vector<std::shared_ptr<monero_output_wallet>> get_outputs(const monero_output_query& query) const override;
std::string get_outputs_hex() const override;
int import_outputs_hex(const std::string& outputs_hex) override;
std::string export_outputs(bool all = false) const override;
int import_outputs(const std::string& outputs_hex) override;
std::vector<std::shared_ptr<monero_key_image>> get_key_images() const override;
std::shared_ptr<monero_key_image_import_result> import_key_images(const std::vector<std::shared_ptr<monero_key_image>>& key_images) override;
std::vector<std::shared_ptr<monero_tx_wallet>> create_txs(const monero_tx_config& config) override;