Apply suggestions from code review #2646

Co-Authored-By: PastaPastaPasta <pasta@dashboost.org>
This commit is contained in:
UdjinM6 2019-01-25 07:06:59 -06:00 committed by GitHub
parent c70aa60792
commit 30b03863ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -93,6 +93,8 @@ UniValue getinfo(const JSONRPCRequest& request)
if (pwallet) { if (pwallet) {
obj.push_back(Pair("walletversion", pwallet->GetVersion())); obj.push_back(Pair("walletversion", pwallet->GetVersion()));
obj.push_back(Pair("balance", ValueFromAmount(pwallet->GetBalance()))); obj.push_back(Pair("balance", ValueFromAmount(pwallet->GetBalance())));
if(!fLiteMode)
obj.push_back(Pair("privatesend_balance", ValueFromAmount(pwallet->GetAnonymizedBalance())));
} }
#endif #endif
obj.push_back(Pair("blocks", (int)chainActive.Height())); obj.push_back(Pair("blocks", (int)chainActive.Height()));

View File

@ -513,9 +513,10 @@ UniValue importwallet(const JSONRPCRequest& request)
file.close(); file.close();
pwallet->ShowProgress("", 100); // hide progress dialog in GUI pwallet->ShowProgress("", 100); // hide progress dialog in GUI
pwallet->UpdateTimeFirstKey(nTimeBegin);
CBlockIndex* pindex = chainActive.FindEarliestAtLeast(nTimeBegin - TIMESTAMP_WINDOW); CBlockIndex* pindex = chainActive.FindEarliestAtLeast(nTimeBegin - TIMESTAMP_WINDOW);
LogPrintf("Rescanning last %i blocks\n", chainActive.Height() - pindex->nHeight + 1); LogPrintf("Rescanning last %i blocks\n", pindex ? chainActive.Height() - pindex->nHeight + 1 : 0);
pwallet->ScanForWalletTransactions(pindex); pwallet->ScanForWalletTransactions(pindex);
pwallet->MarkDirty(); pwallet->MarkDirty();

View File

@ -124,7 +124,7 @@ UniValue getnewaddress(const JSONRPCRequest& request)
if (request.params.size() > 0) if (request.params.size() > 0)
strAccount = AccountFromValue(request.params[0]); strAccount = AccountFromValue(request.params[0]);
if (!pwallet->IsLocked()) { if (!pwallet->IsLocked(true)) {
pwallet->TopUpKeyPool(); pwallet->TopUpKeyPool();
} }
@ -206,7 +206,7 @@ UniValue getrawchangeaddress(const JSONRPCRequest& request)
LOCK2(cs_main, pwallet->cs_wallet); LOCK2(cs_main, pwallet->cs_wallet);
if (!pwallet->IsLocked()) { if (!pwallet->IsLocked(true)) {
pwallet->TopUpKeyPool(); pwallet->TopUpKeyPool();
} }