@@ -594,13 +594,17 @@ UniValue getstakingstatus(const UniValue& params, bool fHelp)
594594
595595 " \n Result:\n "
596596 " {\n "
597- " \" validtime\" : true|false, (boolean) if the chain tip is within staking phases\n "
597+ " \" staking_enabled\" : true|false, (boolean) if staking is enabled/disabled in pivx.conf\n "
598+ " \" tiptime\" : n, (integer) chain tip blocktime\n "
598599 " \" haveconnections\" : true|false, (boolean) if network connections are present\n "
599600 " \" walletunlocked\" : true|false, (boolean) if the wallet is unlocked\n "
600601 " \" mintablecoins\" : true|false, (boolean) if the wallet has mintable coins\n "
601602 " \" enoughcoins\" : true|false, (boolean) if available coins are greater than reserve balance\n "
602603 " \" mnsync\" : true|false, (boolean) if masternode data is synced\n "
603- " \" staking status\" : true|false, (boolean) if the wallet is staking or not\n "
604+ " \" hashLastStakeAttempt\" : xxx (hex string) hash of last block on top of which the miner attempted to stake\n "
605+ " \" heightLastStakeAttempt\" : n (integer) height of last block on top of which the miner attempted to stake\n "
606+ " \" timeLastStakeAttempt\" : n (integer) time of last attempted stake\n "
607+ " \" staking_status\" : true|false, (boolean) if the wallet is staking or not\n "
604608 " }\n "
605609
606610 " \n Examples:\n " +
@@ -613,15 +617,21 @@ UniValue getstakingstatus(const UniValue& params, bool fHelp)
613617#endif
614618
615619 UniValue obj (UniValue::VOBJ);
616- obj.push_back (Pair (" validtime" , chainActive.Tip ()->nTime > 1471482000 ));
620+ obj.push_back (Pair (" staking_enabled" , GetBoolArg (" -staking" , true )));
621+ obj.push_back (Pair (" tiptime" , (int )chainActive.Tip ()->nTime ));
617622 obj.push_back (Pair (" haveconnections" , !vNodes.empty ()));
618623 if (pwalletMain) {
619624 obj.push_back (Pair (" walletunlocked" , !pwalletMain->IsLocked ()));
620625 obj.push_back (Pair (" mintablecoins" , pwalletMain->MintableCoins ()));
621- obj.push_back (Pair (" enoughcoins" , nReserveBalance <= pwalletMain->GetBalance ( )));
626+ obj.push_back (Pair (" enoughcoins" , nReserveBalance <= pwalletMain->GetStakingBalance ( GetBoolArg ( " -coldstaking " , true ) )));
622627 }
623628 obj.push_back (Pair (" mnsync" , masternodeSync.IsSynced ()));
624- obj.push_back (Pair (" staking status" , pwalletMain->pStakerStatus ->IsActive ()));
629+ uint256 lastHash = pwalletMain->pStakerStatus ->GetLastHash ();
630+ obj.push_back (Pair (" hashLastStakeAttempt" , lastHash.GetHex ()));
631+ obj.push_back (Pair (" heightLastStakeAttempt" , (mapBlockIndex.count (lastHash) > 0 ?
632+ mapBlockIndex.at (lastHash)->nHeight : -1 )) );
633+ obj.push_back (Pair (" timeLastStakeAttempt" , pwalletMain->pStakerStatus ->GetLastTime ()));
634+ obj.push_back (Pair (" staking_status" , pwalletMain->pStakerStatus ->IsActive ()));
625635
626636 return obj;
627637}
0 commit comments