wallet_rpc_server: optionally return tx keys in sign_transfer

This commit is contained in:
moneromooo-monero 2018-10-10 15:54:59 +00:00
parent c23b6f8f56
commit 67e76aa06c
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
3 changed files with 10 additions and 0 deletions

View file

@ -5607,6 +5607,10 @@ bool wallet2::sign_tx(unsigned_tx_set &exported_txs, std::vector<wallet2::pendin
ptx.construction_data = sd; ptx.construction_data = sd;
txs.push_back(ptx); txs.push_back(ptx);
// add tx keys only to ptx
txs.back().tx_key = tx_key;
txs.back().additional_tx_keys = additional_tx_keys;
} }
// add key images // add key images

View file

@ -981,6 +981,8 @@ namespace tools
for (auto &ptx: ptxs) for (auto &ptx: ptxs)
{ {
res.tx_hash_list.push_back(epee::string_tools::pod_to_hex(cryptonote::get_transaction_hash(ptx.tx))); res.tx_hash_list.push_back(epee::string_tools::pod_to_hex(cryptonote::get_transaction_hash(ptx.tx)));
if (req.get_tx_keys)
res.tx_key_list.push_back(epee::string_tools::pod_to_hex(ptx.tx_key));
} }
if (req.export_raw) if (req.export_raw)

View file

@ -537,10 +537,12 @@ namespace wallet_rpc
{ {
std::string unsigned_txset; std::string unsigned_txset;
bool export_raw; bool export_raw;
bool get_tx_keys;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(unsigned_txset) KV_SERIALIZE(unsigned_txset)
KV_SERIALIZE_OPT(export_raw, false) KV_SERIALIZE_OPT(export_raw, false)
KV_SERIALIZE_OPT(get_tx_keys, false)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
@ -549,11 +551,13 @@ namespace wallet_rpc
std::string signed_txset; std::string signed_txset;
std::list<std::string> tx_hash_list; std::list<std::string> tx_hash_list;
std::list<std::string> tx_raw_list; std::list<std::string> tx_raw_list;
std::list<std::string> tx_key_list;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(signed_txset) KV_SERIALIZE(signed_txset)
KV_SERIALIZE(tx_hash_list) KV_SERIALIZE(tx_hash_list)
KV_SERIALIZE(tx_raw_list) KV_SERIALIZE(tx_raw_list)
KV_SERIALIZE(tx_key_list)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
}; };