Skip to content

Commit b379e0f

Browse files
thepastaclawclaude
andcommitted
fix: don't gate platform port fields behind -deprecatedrpc=service on v23.1.x
The dashpay#7360 backport imported develop's `IsServiceDeprecatedRPCEnabled()` gate around platformP2PPort/platformHTTPPort in CDeterministicMNStateDiff::ToJson, and re-added the helper to evo/netinfo.{h,cpp} because it does not exist here. That gate is dead on this release line. bbcd9d5 ("rpc: remove -deprecatedrpc=service gating for service") removed gating on 23.x and left the fields unenforced; upstream only restored it in dashpay#7181 (e50d436), which targets the v24 line and is not an ancestor of this branch. Nothing on 23.x passes -deprecatedrpc=service, and every sibling field (service in dmnstate.cpp, and all of core_write.cpp) is emitted unconditionally here. So on a default v23.1.8 node the condition was always false and both keys disappeared entirely from protx diff/listdiff -- a regression against v23.1.7, which emitted them unconditionally, and a contradiction of this release's own notes promising they "report the corresponding non-zero values instead of stale zeroes". Emit them unconditionally, keeping dashpay#7360's actual fix (report the live port from netInfo when the diff carries an ExtAddr netInfo). Drop the now-unused helper so the branch does not carry a gate nothing can turn on. Reported-by: knst Co-Authored-By: Claude <noreply@anthropic.com>
1 parent bcdb34c commit b379e0f

3 files changed

Lines changed: 21 additions & 27 deletions

File tree

src/evo/dmnstate.cpp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,27 @@ UniValue CDeterministicMNStateDiff::ToJson(MnType nType) const
8787
if (fields & Field_platformNodeID) {
8888
obj.pushKV("platformNodeID", state.platformNodeID.ToString());
8989
}
90-
if (IsServiceDeprecatedRPCEnabled()) {
91-
// platformP2PPort/platformHTTPPort are deprecated scalar duplicates of netInfo's
92-
// Platform entries. From ExtAddr onwards the scalar fields are unused (always 0), so
93-
// when the diff carries an ExtAddr netInfo report the live port from it to stay
94-
// consistent with the "addresses" output below.
95-
const bool has_ext_netinfo = (fields & Field_netInfo) && state.netInfo->CanStorePlatform();
96-
if (fields & Field_platformP2PPort) {
97-
obj.pushKV("platformP2PPort",
98-
has_ext_netinfo && state.netInfo->HasEntries(NetInfoPurpose::PLATFORM_P2P)
99-
? state.netInfo->GetEntries(NetInfoPurpose::PLATFORM_P2P)[0].GetPort()
100-
: state.platformP2PPort);
101-
}
102-
if (fields & Field_platformHTTPPort) {
103-
obj.pushKV("platformHTTPPort",
104-
has_ext_netinfo && state.netInfo->HasEntries(NetInfoPurpose::PLATFORM_HTTPS)
105-
? state.netInfo->GetEntries(NetInfoPurpose::PLATFORM_HTTPS)[0].GetPort()
106-
: state.platformHTTPPort);
107-
}
90+
// platformP2PPort/platformHTTPPort are deprecated scalar duplicates of netInfo's
91+
// Platform entries. From ExtAddr onwards the scalar fields are unused (always 0), so
92+
// when the diff carries an ExtAddr netInfo report the live port from it to stay
93+
// consistent with the "addresses" output below.
94+
//
95+
// NOTE: unlike develop, v23.1.x does not gate these fields behind
96+
// -deprecatedrpc=service. That gating was removed in bbcd9d543e6 and only restored
97+
// upstream by #7181, which targets the v24 line and is not part of this release.
98+
// Gating here would drop the fields entirely for every default node.
99+
const bool has_ext_netinfo = (fields & Field_netInfo) && state.netInfo->CanStorePlatform();
100+
if (fields & Field_platformP2PPort) {
101+
obj.pushKV("platformP2PPort",
102+
has_ext_netinfo && state.netInfo->HasEntries(NetInfoPurpose::PLATFORM_P2P)
103+
? state.netInfo->GetEntries(NetInfoPurpose::PLATFORM_P2P)[0].GetPort()
104+
: state.platformP2PPort);
105+
}
106+
if (fields & Field_platformHTTPPort) {
107+
obj.pushKV("platformHTTPPort",
108+
has_ext_netinfo && state.netInfo->HasEntries(NetInfoPurpose::PLATFORM_HTTPS)
109+
? state.netInfo->GetEntries(NetInfoPurpose::PLATFORM_HTTPS)[0].GetPort()
110+
: state.platformHTTPPort);
108111
}
109112
}
110113
{

src/evo/netinfo.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ bool IsAllowedPlatformHTTPPort(uint16_t port)
7070

7171
bool IsNodeOnMainnet() { return Params().NetworkIDString() == CBaseChainParams::MAIN; }
7272

73-
bool IsServiceDeprecatedRPCEnabled()
74-
{
75-
const auto args = gArgs.GetArgs("-deprecatedrpc");
76-
return std::find(args.begin(), args.end(), "service") != args.end();
77-
}
78-
7973
const CChainParams& MainParams()
8074
{
8175
std::call_once(g_main_params_flag, [&]() { g_main_params = CreateChainParams(::gArgs, CBaseChainParams::MAIN); });

src/evo/netinfo.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ constexpr std::string_view PurposeToString(const NetInfoPurpose purpose)
9797
return "";
9898
}
9999

100-
/** Identical to IsDeprecatedRPCEnabled("service"). For use outside of RPC code */
101-
bool IsServiceDeprecatedRPCEnabled();
102-
103100
/** Will return true if node is running on mainnet */
104101
bool IsNodeOnMainnet();
105102

0 commit comments

Comments
 (0)