@@ -53,6 +53,7 @@ static UniValue gobject_count(const JSONRPCRequest& request)
53
53
gobject_count_help (request);
54
54
55
55
const NodeContext& node = EnsureAnyNodeContext (request.context );
56
+ CHECK_NONFATAL (node.govman );
56
57
return strMode == " json" ? node.govman ->ToJson () : node.govman ->ToString ();
57
58
}
58
59
@@ -309,6 +310,8 @@ static UniValue gobject_submit(const JSONRPCRequest& request)
309
310
gobject_submit_help (request);
310
311
311
312
const NodeContext& node = EnsureAnyNodeContext (request.context );
313
+ CHECK_NONFATAL (node.dmnman );
314
+ CHECK_NONFATAL (node.govman );
312
315
313
316
if (!node.mn_sync ->IsBlockchainSynced ()) {
314
317
throw JSONRPCError (RPC_CLIENT_IN_INITIAL_DOWNLOAD, " Must wait for client to sync with masternode network. Try again in a minute or so." );
@@ -395,7 +398,9 @@ static UniValue gobject_submit(const JSONRPCRequest& request)
395
398
396
399
LogPrintf (" gobject(submit) -- Adding locally created governance object - %s\n " , strHash);
397
400
401
+ CHECK_NONFATAL (node.peerman );
398
402
if (fMissingConfirmations ) {
403
+ CHECK_NONFATAL (node.mn_sync );
399
404
node.govman ->AddPostponedObject (govobj);
400
405
govobj.Relay (*node.peerman , *node.mn_sync );
401
406
} else {
@@ -410,6 +415,7 @@ static UniValue VoteWithMasternodes(const JSONRPCRequest& request, const std::ma
410
415
vote_outcome_enum_t eVoteOutcome)
411
416
{
412
417
const NodeContext& node = EnsureAnyNodeContext (request.context );
418
+ CHECK_NONFATAL (node.govman );
413
419
{
414
420
LOCK (node.govman ->cs );
415
421
const CGovernanceObject *pGovObj = node.govman ->FindConstGovernanceObject (hash);
@@ -450,6 +456,8 @@ static UniValue VoteWithMasternodes(const JSONRPCRequest& request, const std::ma
450
456
}
451
457
452
458
CGovernanceException exception;
459
+ CHECK_NONFATAL (node.connman );
460
+ CHECK_NONFATAL (node.peerman );
453
461
if (node.govman ->ProcessVoteAndRelay (vote, exception, *node.connman , *node.peerman )) {
454
462
nSuccessful++;
455
463
statusObj.pushKV (" result" , " success" );
@@ -493,6 +501,7 @@ static UniValue gobject_vote_many(const JSONRPCRequest& request)
493
501
if (!wallet) return NullUniValue;
494
502
495
503
const NodeContext& node = EnsureAnyNodeContext (request.context );
504
+ CHECK_NONFATAL (node.dmnman );
496
505
497
506
uint256 hash (ParseHashV (request.params [0 ], " Object hash" ));
498
507
std::string strVoteSignal = request.params [1 ].get_str ();
@@ -554,6 +563,7 @@ static UniValue gobject_vote_alias(const JSONRPCRequest& request)
554
563
if (!wallet) return NullUniValue;
555
564
556
565
const NodeContext& node = EnsureAnyNodeContext (request.context );
566
+ CHECK_NONFATAL (node.dmnman );
557
567
558
568
uint256 hash (ParseHashV (request.params [0 ], " Object hash" ));
559
569
std::string strVoteSignal = request.params [1 ].get_str ();
@@ -690,6 +700,7 @@ static UniValue gobject_list(const JSONRPCRequest& request)
690
700
691
701
const NodeContext& node = EnsureAnyNodeContext (request.context );
692
702
CHECK_NONFATAL (node.dmnman );
703
+ CHECK_NONFATAL (node.govman );
693
704
694
705
return ListObjects (*node.govman , node.dmnman ->GetListAtChainTip (), strCachedSignal, strType, 0 );
695
706
}
@@ -857,6 +868,7 @@ static UniValue gobject_getcurrentvotes(const JSONRPCRequest& request)
857
868
858
869
// FIND OBJECT USER IS LOOKING FOR
859
870
const NodeContext& node = EnsureAnyNodeContext (request.context );
871
+ CHECK_NONFATAL (node.govman );
860
872
861
873
LOCK (node.govman ->cs );
862
874
const CGovernanceObject* pGovObj = node.govman ->FindConstGovernanceObject (hash);
@@ -995,6 +1007,7 @@ static UniValue voteraw(const JSONRPCRequest& request)
995
1007
}
996
1008
997
1009
const NodeContext& node = EnsureAnyNodeContext (request.context );
1010
+ CHECK_NONFATAL (node.govman );
998
1011
GovernanceObject govObjType = WITH_LOCK (node.govman ->cs , return [&](){
999
1012
AssertLockHeld (node.govman ->cs );
1000
1013
const CGovernanceObject *pGovObj = node.govman ->FindConstGovernanceObject (hashGovObj);
@@ -1032,6 +1045,9 @@ static UniValue voteraw(const JSONRPCRequest& request)
1032
1045
throw JSONRPCError (RPC_INTERNAL_ERROR, " Failure to verify vote." );
1033
1046
}
1034
1047
1048
+ CHECK_NONFATAL (node.connman );
1049
+ CHECK_NONFATAL (node.peerman );
1050
+
1035
1051
CGovernanceException exception;
1036
1052
if (node.govman ->ProcessVoteAndRelay (vote, exception, *node.connman , *node.peerman )) {
1037
1053
return " Voted successfully" ;
@@ -1068,6 +1084,7 @@ static UniValue getgovernanceinfo(const JSONRPCRequest& request)
1068
1084
1069
1085
const NodeContext& node = EnsureAnyNodeContext (request.context );
1070
1086
const ChainstateManager& chainman = EnsureAnyChainman (request.context );
1087
+ CHECK_NONFATAL (node.dmnman );
1071
1088
1072
1089
const auto * pindex = WITH_LOCK (cs_main, return chainman.ActiveChain ().Tip ());
1073
1090
int nBlockHeight = pindex->nHeight ;
0 commit comments