diff --git a/src/masternodes/rpc_customtx.cpp b/src/masternodes/rpc_customtx.cpp index bae9d51f0aa..c3241db07b5 100644 --- a/src/masternodes/rpc_customtx.cpp +++ b/src/masternodes/rpc_customtx.cpp @@ -84,16 +84,21 @@ class CCustomTxRpcVisitor void operator()(const CUpdateMasterNodeMessage& obj) const { rpcInfo.pushKV("id", obj.mnId.GetHex()); - for (const auto& item : obj.updates) { - if (item.first == static_cast(UpdateMasternodeType::OperatorAddress)) { - rpcInfo.pushKV("operatorAddress", EncodeDestination(item.second.first == PKHashType ? - CTxDestination(PKHash(item.second.second)) : - CTxDestination(WitnessV0KeyHash(item.second.second)))); - } else if (item.first == static_cast(UpdateMasternodeType::SetRewardAddress)) { - rpcInfo.pushKV("rewardAddress", EncodeDestination(item.second.first == PKHashType ? - CTxDestination(PKHash(item.second.second)) : - CTxDestination(WitnessV0KeyHash(item.second.second)))); - } else if (item.first == static_cast(UpdateMasternodeType::RemRewardAddress)) { + for (const auto& [updateType, addressPair] : obj.updates) { + const auto& [addressType, rawAddress] = addressPair; + if (updateType == static_cast(UpdateMasternodeType::OperatorAddress)) { + rpcInfo.pushKV("operatorAddress", EncodeDestination(addressType == PKHashType ? + CTxDestination(PKHash(rawAddress)) : + CTxDestination(WitnessV0KeyHash(rawAddress)))); + } else if (updateType == static_cast(UpdateMasternodeType::OwnerAddress)) { + rpcInfo.pushKV("ownerAddress", EncodeDestination(addressType == PKHashType ? + CTxDestination(PKHash(rawAddress)) : + CTxDestination(WitnessV0KeyHash(rawAddress)))); + } if (updateType == static_cast(UpdateMasternodeType::SetRewardAddress)) { + rpcInfo.pushKV("rewardAddress", EncodeDestination(addressType == PKHashType ? + CTxDestination(PKHash(rawAddress)) : + CTxDestination(WitnessV0KeyHash(rawAddress)))); + } else if (updateType == static_cast(UpdateMasternodeType::RemRewardAddress)) { rpcInfo.pushKV("rewardAddress", ""); } }