From c078e666a4472481af8c4469da6fd1f140e65fc6 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 22 Aug 2022 22:43:07 +0300 Subject: [PATCH] feat(rpc): Add `service` field for each member in `quorum info` results (#4977) * feat(rpc): Add `service` field for each member in `quorum info` results * add test --- src/rpc/rpcquorums.cpp | 1 + test/functional/rpc_quorum.py | 31 +++++++++++++++++++++++++++++++ test/functional/test_runner.py | 1 + 3 files changed, 33 insertions(+) create mode 100644 test/functional/rpc_quorum.py diff --git a/src/rpc/rpcquorums.cpp b/src/rpc/rpcquorums.cpp index 81fbf151b1..7afb0a6b75 100644 --- a/src/rpc/rpcquorums.cpp +++ b/src/rpc/rpcquorums.cpp @@ -111,6 +111,7 @@ static UniValue BuildQuorumInfo(const llmq::CQuorumCPtr& quorum, bool includeMem auto& dmn = quorum->members[i]; UniValue mo(UniValue::VOBJ); mo.pushKV("proTxHash", dmn->proTxHash.ToString()); + mo.pushKV("service", dmn->pdmnState->addr.ToString()); mo.pushKV("pubKeyOperator", dmn->pdmnState->pubKeyOperator.Get().ToString()); mo.pushKV("valid", quorum->qc->validMembers[i]); if (quorum->qc->validMembers[i]) { diff --git a/test/functional/rpc_quorum.py b/test/functional/rpc_quorum.py new file mode 100644 index 0000000000..d8dfd57bfc --- /dev/null +++ b/test/functional/rpc_quorum.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +# Copyright (c) 2022 The Dash Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +from test_framework.test_framework import DashTestFramework +from test_framework.util import assert_equal, p2p_port + +''' +rpc_quorum.py + +Test "quorum" rpc subcommands +''' + +class RPCMasternodeTest(DashTestFramework): + def set_test_params(self): + self.set_dash_test_params(4, 3, fast_dip3_enforcement=True) + + def run_test(self): + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.wait_for_sporks_same() + quorum_hash = self.mine_quorum() + + quorum_info = self.nodes[0].quorum("info", 100, quorum_hash) + for idx in range(0, self.mn_count): + mn = self.mninfo[idx] + for member in quorum_info["members"]: + if member["proTxHash"] == mn.proTxHash: + assert_equal(member["service"], '127.0.0.1:%d' % p2p_port(mn.nodeIdx)) + +if __name__ == '__main__': + RPCMasternodeTest().main() diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index e8c17a1009..cba240c946 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -129,6 +129,7 @@ BASE_SCRIPTS = [ 'feature_reindex.py', 'feature_abortnode.py', # vv Tests less than 30s vv + 'rpc_quorum.py', 'wallet_keypool_topup.py', 'interface_zmq_dash.py', 'interface_zmq.py',