From 7807454aa18f761e8b5bb1e21e77256ed14f5e26 Mon Sep 17 00:00:00 2001 From: Mihailo Milenkovic Date: Thu, 2 Feb 2023 11:13:43 +0100 Subject: [PATCH 1/2] Fix voting scenarios test (#1727) --- test/functional/feature_on_chain_government_voting_scenarios.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/feature_on_chain_government_voting_scenarios.py b/test/functional/feature_on_chain_government_voting_scenarios.py index aa09fb6757..061a56039d 100755 --- a/test/functional/feature_on_chain_government_voting_scenarios.py +++ b/test/functional/feature_on_chain_government_voting_scenarios.py @@ -19,7 +19,7 @@ def set_test_params(self): self.num_nodes = 1 self.setup_clean_chain = True self.extra_args = [ - ['-jellyfish_regtest=1', '-dummypos=0', '-txnotokens=0', '-amkheight=50', '-bayfrontheight=51', '-eunosheight=80', '-fortcanningheight=82', '-fortcanninghillheight=84', '-fortcanningroadheight=86', '-fortcanningcrunchheight=88', '-fortcanningspringheight=90', '-fortcanninggreatworldheight=94', '-grandcentralheight=101', '-simulatemainnet=1'], + ['-jellyfish_regtest=1', '-dummypos=0', '-txnotokens=0', '-amkheight=50', '-bayfrontheight=51', '-eunosheight=80', '-fortcanningheight=82', '-fortcanninghillheight=84', '-fortcanningroadheight=86', '-fortcanningcrunchheight=88', '-fortcanningspringheight=90', '-fortcanninggreatworldheight=94', '-grandcentralheight=101', '-rpc-governance-accept-neutral=1', '-simulatemainnet=1'], ] def setup_masternodes(self, nMasternodes = 19): From faaad566400af622960f312a750dc1869486a2ea Mon Sep 17 00:00:00 2001 From: Shoham Chakraborty Date: Thu, 2 Feb 2023 20:09:41 +0800 Subject: [PATCH 2/2] Fix setgov crashes (#1719) Co-authored-by: Prasanna Loganathar --- src/masternodes/mn_rpc.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/masternodes/mn_rpc.cpp b/src/masternodes/mn_rpc.cpp index 949cdbff08..c79c270442 100644 --- a/src/masternodes/mn_rpc.cpp +++ b/src/masternodes/mn_rpc.cpp @@ -583,10 +583,12 @@ UniValue setgov(const JSONRPCRequest& request) { CCoinControl coinControl; // Set change to selected foundation address - CTxDestination dest; - ExtractDestination(*auths.cbegin(), dest); - if (IsValidDestination(dest)) { - coinControl.destChange = dest; + if (!auths.empty()) { + CTxDestination dest; + ExtractDestination(*auths.cbegin(), dest); + if (IsValidDestination(dest)) { + coinControl.destChange = dest; + } } fund(rawTx, pwallet, optAuthTx, &coinControl); @@ -673,10 +675,12 @@ UniValue unsetgov(const JSONRPCRequest& request) { CCoinControl coinControl; // Set change to selected foundation address - CTxDestination dest; - ExtractDestination(*auths.cbegin(), dest); - if (IsValidDestination(dest)) { - coinControl.destChange = dest; + if (!auths.empty()) { + CTxDestination dest; + ExtractDestination(*auths.cbegin(), dest); + if (IsValidDestination(dest)) { + coinControl.destChange = dest; + } } fund(rawTx, pwallet, optAuthTx, &coinControl); @@ -767,10 +771,12 @@ UniValue setgovheight(const JSONRPCRequest& request) { CCoinControl coinControl; // Set change to selected foundation address - CTxDestination dest; - ExtractDestination(*auths.cbegin(), dest); - if (IsValidDestination(dest)) { - coinControl.destChange = dest; + if (!auths.empty()) { + CTxDestination dest; + ExtractDestination(*auths.cbegin(), dest); + if (IsValidDestination(dest)) { + coinControl.destChange = dest; + } } fund(rawTx, pwallet, optAuthTx, &coinControl);