diff options
| author | Jeff Garzik <[email protected]> | 2013-10-01 16:18:50 -0400 |
|---|---|---|
| committer | Jeff Garzik <[email protected]> | 2013-10-01 16:18:50 -0400 |
| commit | 19e5ae7369de8ff556b2ea008850a62b1fde9a1b (patch) | |
| tree | 4b712da1581c88940fd7fcf1a4dc184419eec792 /src/rpcwallet.cpp | |
| parent | Merge pull request #2991 from Diapolo/translation_fixes (diff) | |
| parent | Support absence of wallet (pwalletMain==NULL) in several locations, (diff) | |
| download | discoin-19e5ae7369de8ff556b2ea008850a62b1fde9a1b.tar.xz discoin-19e5ae7369de8ff556b2ea008850a62b1fde9a1b.zip | |
Merge branch 'pwalletmain' - checking pwalletMain for NULL,
a pre-req for no-wallet support.
Diffstat (limited to 'src/rpcwallet.cpp')
| -rw-r--r-- | src/rpcwallet.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 46338bdf2..4bf358032 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -21,7 +21,7 @@ static CCriticalSection cs_nWalletUnlockTime; std::string HelpRequiringPassphrase() { - return pwalletMain->IsCrypted() + return pwalletMain && pwalletMain->IsCrypted() ? "\nrequires wallet passphrase to be set with walletpassphrase first" : ""; } @@ -72,18 +72,22 @@ Value getinfo(const Array& params, bool fHelp) Object obj; obj.push_back(Pair("version", (int)CLIENT_VERSION)); obj.push_back(Pair("protocolversion",(int)PROTOCOL_VERSION)); - obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); - obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); + if (pwalletMain) { + obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); + obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); + } obj.push_back(Pair("blocks", (int)nBestHeight)); obj.push_back(Pair("timeoffset", (boost::int64_t)GetTimeOffset())); obj.push_back(Pair("connections", (int)vNodes.size())); obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string()))); obj.push_back(Pair("difficulty", (double)GetDifficulty())); obj.push_back(Pair("testnet", TestNet())); - obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime())); - obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); + if (pwalletMain) { + obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime())); + obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); + } obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee))); - if (pwalletMain->IsCrypted()) + if (pwalletMain && pwalletMain->IsCrypted()) obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime)); obj.push_back(Pair("errors", GetWarnings("statusbar"))); return obj; @@ -738,7 +742,7 @@ static CScript _createmultisig(const Array& params) // Case 1: Bitcoin address and we have full public key: CBitcoinAddress address(ks); - if (address.IsValid()) + if (pwalletMain && address.IsValid()) { CKeyID keyID; if (!address.GetKeyID(keyID)) |