Merge pull request #853 from laanwj/2012_02_altminimizetray
[novacoin.git] / src / wallet.cpp
index da64aa5..30590c8 100644 (file)
@@ -17,9 +17,16 @@ using namespace std;
 
 std::vector<unsigned char> CWallet::GenerateNewKey()
 {
+    bool fCompressed = true; // default to compressed public keys
+
     RandAddSeedPerfmon();
     CKey key;
-    key.MakeNewKey();
+    key.MakeNewKey(fCompressed);
+
+    // Compressed public keys were introduced in version 0.6.0
+    if (fCompressed)
+        SetMinVersion(59900);
+
     if (!AddKey(key))
         throw std::runtime_error("CWallet::GenerateNewKey() : AddKey failed");
     return key.GetPubKey();
@@ -228,7 +235,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
             if (!pwalletdbEncryption->TxnCommit())
                 exit(1); //We now have keys encrypted in memory, but no on disk...die to avoid confusion and let the user reload their unencrypted wallet.
 
-            pwalletdbEncryption->Close();
+            delete pwalletdbEncryption;
             pwalletdbEncryption = NULL;
         }