1
0
Fork 0
forked from lthn/blockchain

minor improvement for fill_tx_rpc_inputs()

This commit is contained in:
sowle 2023-08-10 13:09:04 +02:00
parent 035f82f605
commit fc1383324a
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
3 changed files with 25 additions and 3 deletions

View file

@ -5211,7 +5211,6 @@ bool blockchain_storage::fill_tx_rpc_inputs(tx_rpc_extended_info& tei, const tra
{
entry_to_fill.htlc_origin = epee::string_tools::buff_to_hex_nodelimer(boost::get<txin_htlc>(in).hltc_origin);
}
//tk.etc_details -> visualize it may be later
}
else if (in.type() == typeid(txin_multisig))
{
@ -5223,8 +5222,30 @@ bool blockchain_storage::fill_tx_rpc_inputs(tx_rpc_extended_info& tei, const tra
{
entry_to_fill.multisig_count = boost::get<NLSAG_sig>(tx.signatures[tei.ins.size() - 1]).s.size();
}
}
const std::vector<txin_etc_details_v>& etc_options = get_txin_etc_options(in);
for (size_t i = 0; i < etc_options.size(); ++i)
{
std::stringstream ss;
if (etc_options[i].type() == typeid(signed_parts))
{
const auto& sp = boost::get<signed_parts>(etc_options[i]);
ss << "n_outs: " << sp.n_outs << ", n_extras: " << sp.n_extras;
entry_to_fill.etc_options.push_back(ss.str());
}
else if (etc_options[i].type() == typeid(extra_attachment_info))
{
const auto& eai = boost::get<extra_attachment_info>(etc_options[i]);
ss << "cnt: " << eai.cnt << ", sz: " << eai.sz << ", hsh: " << eai.hsh;
entry_to_fill.etc_options.push_back(ss.str());
}
else
{
entry_to_fill.etc_options.push_back("unknown type");
}
}
}
return true;
}

View file

@ -636,7 +636,6 @@ namespace currency
bool check_block_timestamp_main(const block& b)const;
bool check_block_timestamp(std::vector<uint64_t> timestamps, const block& b)const;
std::vector<uint64_t> get_last_n_blocks_timestamps(size_t n)const;
const std::vector<txin_etc_details_v>& get_txin_etc_options(const txin_v& in)const;
void on_block_added(const block_extended_info& bei, const crypto::hash& id, const std::list<crypto::key_image>& bsk);
void on_block_removed(const block_extended_info& bei);
void update_targetdata_cache_on_block_added(const block_extended_info& bei);

View file

@ -1191,12 +1191,14 @@ namespace currency
std::string htlc_origin;
std::string kimage_or_ms_id;
std::vector<uint64_t> global_indexes;
std::vector<std::string> etc_options;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(amount)
KV_SERIALIZE(htlc_origin)
KV_SERIALIZE(kimage_or_ms_id)
KV_SERIALIZE(global_indexes)
KV_SERIALIZE(multisig_count)
KV_SERIALIZE(etc_options)
END_KV_SERIALIZE_MAP()
};