mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 05:32:22 +02:00
refactor: use structured bindings for map entries
This commit is contained in:
@@ -293,16 +293,18 @@ static RPCMethod getpeerinfo()
|
||||
obj.pushKV("minfeefilter", ValueFromAmount(statestats.m_fee_filter_received));
|
||||
|
||||
UniValue sendPerMsgType(UniValue::VOBJ);
|
||||
for (const auto& i : stats.mapSendBytesPerMsgType) {
|
||||
if (i.second > 0)
|
||||
sendPerMsgType.pushKVEnd(i.first, i.second);
|
||||
for (const auto& [message_type, total_bytes] : stats.mapSendBytesPerMsgType) {
|
||||
if (total_bytes > 0) {
|
||||
sendPerMsgType.pushKVEnd(message_type, total_bytes);
|
||||
}
|
||||
}
|
||||
obj.pushKV("bytessent_per_msg", std::move(sendPerMsgType));
|
||||
|
||||
UniValue recvPerMsgType(UniValue::VOBJ);
|
||||
for (const auto& i : stats.mapRecvBytesPerMsgType) {
|
||||
if (i.second > 0)
|
||||
recvPerMsgType.pushKVEnd(i.first, i.second);
|
||||
for (const auto& [message_type, total_bytes] : stats.mapRecvBytesPerMsgType) {
|
||||
if (total_bytes > 0) {
|
||||
recvPerMsgType.pushKVEnd(message_type, total_bytes);
|
||||
}
|
||||
}
|
||||
obj.pushKV("bytesrecv_per_msg", std::move(recvPerMsgType));
|
||||
obj.pushKV("connection_type", ConnectionTypeAsString(stats.m_conn_type));
|
||||
|
||||
@@ -1164,8 +1164,8 @@ static RPCMethod decodepsbt()
|
||||
|
||||
// Unknown data
|
||||
UniValue unknowns(UniValue::VOBJ);
|
||||
for (auto entry : psbtx.unknown) {
|
||||
unknowns.pushKVEnd(HexStr(entry.first), HexStr(entry.second));
|
||||
for (auto [key, value] : psbtx.unknown) {
|
||||
unknowns.pushKVEnd(HexStr(key), HexStr(value));
|
||||
}
|
||||
result.pushKV("unknown", std::move(unknowns));
|
||||
|
||||
@@ -1448,8 +1448,8 @@ static RPCMethod decodepsbt()
|
||||
// Unknown data
|
||||
if (input.unknown.size() > 0) {
|
||||
UniValue unknowns(UniValue::VOBJ);
|
||||
for (auto entry : input.unknown) {
|
||||
unknowns.pushKVEnd(HexStr(entry.first), HexStr(entry.second));
|
||||
for (auto [key, value] : input.unknown) {
|
||||
unknowns.pushKVEnd(HexStr(key), HexStr(value));
|
||||
}
|
||||
in.pushKV("unknown", std::move(unknowns));
|
||||
}
|
||||
@@ -1567,8 +1567,8 @@ static RPCMethod decodepsbt()
|
||||
// Unknown data
|
||||
if (output.unknown.size() > 0) {
|
||||
UniValue unknowns(UniValue::VOBJ);
|
||||
for (auto entry : output.unknown) {
|
||||
unknowns.pushKVEnd(HexStr(entry.first), HexStr(entry.second));
|
||||
for (auto [key, value] : output.unknown) {
|
||||
unknowns.pushKVEnd(HexStr(key), HexStr(value));
|
||||
}
|
||||
out.pushKV("unknown", std::move(unknowns));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user