mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-30 03:03:17 +00:00
wallet_rpc_server: add tx weight in transfer commands responses
This commit is contained in:
parent
a48ef0a65a
commit
b328de6b7a
3 changed files with 18 additions and 7 deletions
|
@ -843,7 +843,7 @@ namespace tools
|
|||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
template<typename Ts, typename Tu>
|
||||
bool wallet_rpc_server::fill_response(std::vector<tools::wallet2::pending_tx> &ptx_vector,
|
||||
bool get_tx_key, Ts& tx_key, Tu &amount, Tu &fee, std::string &multisig_txset, std::string &unsigned_txset, bool do_not_relay,
|
||||
bool get_tx_key, Ts& tx_key, Tu &amount, Tu &fee, Tu &weight, std::string &multisig_txset, std::string &unsigned_txset, bool do_not_relay,
|
||||
Ts &tx_hash, bool get_tx_hex, Ts &tx_blob, bool get_tx_metadata, Ts &tx_metadata, epee::json_rpc::error &er)
|
||||
{
|
||||
for (const auto & ptx : ptx_vector)
|
||||
|
@ -858,6 +858,7 @@ namespace tools
|
|||
// Compute amount leaving wallet in tx. By convention dests does not include change outputs
|
||||
fill(amount, total_amount(ptx));
|
||||
fill(fee, ptx.fee);
|
||||
fill(weight, cryptonote::get_transaction_weight(ptx.tx));
|
||||
}
|
||||
|
||||
if (m_wallet->multisig())
|
||||
|
@ -943,7 +944,7 @@ namespace tools
|
|||
return false;
|
||||
}
|
||||
|
||||
return fill_response(ptx_vector, req.get_tx_key, res.tx_key, res.amount, res.fee, res.multisig_txset, res.unsigned_txset, req.do_not_relay,
|
||||
return fill_response(ptx_vector, req.get_tx_key, res.tx_key, res.amount, res.fee, res.weight, res.multisig_txset, res.unsigned_txset, req.do_not_relay,
|
||||
res.tx_hash, req.get_tx_hex, res.tx_blob, req.get_tx_metadata, res.tx_metadata, er);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
@ -989,7 +990,7 @@ namespace tools
|
|||
return false;
|
||||
}
|
||||
|
||||
return fill_response(ptx_vector, req.get_tx_keys, res.tx_key_list, res.amount_list, res.fee_list, res.multisig_txset, res.unsigned_txset, req.do_not_relay,
|
||||
return fill_response(ptx_vector, req.get_tx_keys, res.tx_key_list, res.amount_list, res.fee_list, res.weight_list, res.multisig_txset, res.unsigned_txset, req.do_not_relay,
|
||||
res.tx_hash_list, req.get_tx_hex, res.tx_blob_list, req.get_tx_metadata, res.tx_metadata_list, er);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
@ -1353,7 +1354,7 @@ namespace tools
|
|||
{
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_unmixable_sweep_transactions();
|
||||
|
||||
return fill_response(ptx_vector, req.get_tx_keys, res.tx_key_list, res.amount_list, res.fee_list, res.multisig_txset, res.unsigned_txset, req.do_not_relay,
|
||||
return fill_response(ptx_vector, req.get_tx_keys, res.tx_key_list, res.amount_list, res.fee_list, res.weight_list, res.multisig_txset, res.unsigned_txset, req.do_not_relay,
|
||||
res.tx_hash_list, req.get_tx_hex, res.tx_blob_list, req.get_tx_metadata, res.tx_metadata_list, er);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
@ -1400,7 +1401,7 @@ namespace tools
|
|||
uint32_t priority = m_wallet->adjust_priority(req.priority);
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_all(req.below_amount, dsts[0].addr, dsts[0].is_subaddress, req.outputs, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices);
|
||||
|
||||
return fill_response(ptx_vector, req.get_tx_keys, res.tx_key_list, res.amount_list, res.fee_list, res.multisig_txset, res.unsigned_txset, req.do_not_relay,
|
||||
return fill_response(ptx_vector, req.get_tx_keys, res.tx_key_list, res.amount_list, res.fee_list, res.weight_list, res.multisig_txset, res.unsigned_txset, req.do_not_relay,
|
||||
res.tx_hash_list, req.get_tx_hex, res.tx_blob_list, req.get_tx_metadata, res.tx_metadata_list, er);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
@ -1475,7 +1476,7 @@ namespace tools
|
|||
return false;
|
||||
}
|
||||
|
||||
return fill_response(ptx_vector, req.get_tx_key, res.tx_key, res.amount, res.fee, res.multisig_txset, res.unsigned_txset, req.do_not_relay,
|
||||
return fill_response(ptx_vector, req.get_tx_key, res.tx_key, res.amount, res.fee, res.weight, res.multisig_txset, res.unsigned_txset, req.do_not_relay,
|
||||
res.tx_hash, req.get_tx_hex, res.tx_blob, req.get_tx_metadata, res.tx_metadata, er);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
|
|
@ -255,7 +255,7 @@ namespace tools
|
|||
|
||||
template<typename Ts, typename Tu>
|
||||
bool fill_response(std::vector<tools::wallet2::pending_tx> &ptx_vector,
|
||||
bool get_tx_key, Ts& tx_key, Tu &amount, Tu &fee, std::string &multisig_txset, std::string &unsigned_txset, bool do_not_relay,
|
||||
bool get_tx_key, Ts& tx_key, Tu &amount, Tu &fee, Tu &weight, std::string &multisig_txset, std::string &unsigned_txset, bool do_not_relay,
|
||||
Ts &tx_hash, bool get_tx_hex, Ts &tx_blob, bool get_tx_metadata, Ts &tx_metadata, epee::json_rpc::error &er);
|
||||
|
||||
bool validate_transfer(const std::list<wallet_rpc::transfer_destination>& destinations, const std::string& payment_id, std::vector<cryptonote::tx_destination_entry>& dsts, std::vector<uint8_t>& extra, bool at_least_one_destination, epee::json_rpc::error& er);
|
||||
|
|
|
@ -484,6 +484,7 @@ namespace wallet_rpc
|
|||
std::string tx_key;
|
||||
uint64_t amount;
|
||||
uint64_t fee;
|
||||
uint64_t weight;
|
||||
std::string tx_blob;
|
||||
std::string tx_metadata;
|
||||
std::string multisig_txset;
|
||||
|
@ -494,6 +495,7 @@ namespace wallet_rpc
|
|||
KV_SERIALIZE(tx_key)
|
||||
KV_SERIALIZE(amount)
|
||||
KV_SERIALIZE(fee)
|
||||
KV_SERIALIZE(weight)
|
||||
KV_SERIALIZE(tx_blob)
|
||||
KV_SERIALIZE(tx_metadata)
|
||||
KV_SERIALIZE(multisig_txset)
|
||||
|
@ -550,6 +552,7 @@ namespace wallet_rpc
|
|||
std::list<std::string> tx_key_list;
|
||||
std::list<uint64_t> amount_list;
|
||||
std::list<uint64_t> fee_list;
|
||||
std::list<uint64_t> weight_list;
|
||||
std::list<std::string> tx_blob_list;
|
||||
std::list<std::string> tx_metadata_list;
|
||||
std::string multisig_txset;
|
||||
|
@ -560,6 +563,7 @@ namespace wallet_rpc
|
|||
KV_SERIALIZE(tx_key_list)
|
||||
KV_SERIALIZE(amount_list)
|
||||
KV_SERIALIZE(fee_list)
|
||||
KV_SERIALIZE(weight_list)
|
||||
KV_SERIALIZE(tx_blob_list)
|
||||
KV_SERIALIZE(tx_metadata_list)
|
||||
KV_SERIALIZE(multisig_txset)
|
||||
|
@ -723,6 +727,7 @@ namespace wallet_rpc
|
|||
std::list<std::string> tx_key_list;
|
||||
std::list<uint64_t> amount_list;
|
||||
std::list<uint64_t> fee_list;
|
||||
std::list<uint64_t> weight_list;
|
||||
std::list<std::string> tx_blob_list;
|
||||
std::list<std::string> tx_metadata_list;
|
||||
std::string multisig_txset;
|
||||
|
@ -733,6 +738,7 @@ namespace wallet_rpc
|
|||
KV_SERIALIZE(tx_key_list)
|
||||
KV_SERIALIZE(amount_list)
|
||||
KV_SERIALIZE(fee_list)
|
||||
KV_SERIALIZE(weight_list)
|
||||
KV_SERIALIZE(tx_blob_list)
|
||||
KV_SERIALIZE(tx_metadata_list)
|
||||
KV_SERIALIZE(multisig_txset)
|
||||
|
@ -793,6 +799,7 @@ namespace wallet_rpc
|
|||
std::list<std::string> tx_key_list;
|
||||
std::list<uint64_t> amount_list;
|
||||
std::list<uint64_t> fee_list;
|
||||
std::list<uint64_t> weight_list;
|
||||
std::list<std::string> tx_blob_list;
|
||||
std::list<std::string> tx_metadata_list;
|
||||
std::string multisig_txset;
|
||||
|
@ -803,6 +810,7 @@ namespace wallet_rpc
|
|||
KV_SERIALIZE(tx_key_list)
|
||||
KV_SERIALIZE(amount_list)
|
||||
KV_SERIALIZE(fee_list)
|
||||
KV_SERIALIZE(weight_list)
|
||||
KV_SERIALIZE(tx_blob_list)
|
||||
KV_SERIALIZE(tx_metadata_list)
|
||||
KV_SERIALIZE(multisig_txset)
|
||||
|
@ -850,6 +858,7 @@ namespace wallet_rpc
|
|||
std::string tx_key;
|
||||
uint64_t amount;
|
||||
uint64_t fee;
|
||||
uint64_t weight;
|
||||
std::string tx_blob;
|
||||
std::string tx_metadata;
|
||||
std::string multisig_txset;
|
||||
|
@ -860,6 +869,7 @@ namespace wallet_rpc
|
|||
KV_SERIALIZE(tx_key)
|
||||
KV_SERIALIZE(amount)
|
||||
KV_SERIALIZE(fee)
|
||||
KV_SERIALIZE(weight)
|
||||
KV_SERIALIZE(tx_blob)
|
||||
KV_SERIALIZE(tx_metadata)
|
||||
KV_SERIALIZE(multisig_txset)
|
||||
|
|
Loading…
Reference in a new issue