X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fwallet.cpp;h=85bf6acebac6d55e7a0111f181023847f84a8201;hp=87ffe936f9701a1f62e77b2bf0a366348955dfaf;hb=40530c08006088e6f610063f1c49428aa0b272f6;hpb=48b27ec277c70795166bc1467c36bc7e1b335a11 diff --git a/src/wallet.cpp b/src/wallet.cpp index 87ffe93..85bf6ac 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -12,6 +12,7 @@ #include "kernel.h" #include "coincontrol.h" #include +#include #include "main.h" @@ -516,6 +517,19 @@ bool CWallet::DecryptWallet(const SecureString& strWalletPassphrase) return true; } +bool CWallet::GetPEM(const CKeyID &keyID, const std::string &fileName, const SecureString &strPassKey) const +{ + BIO *pemOut = BIO_new_file(fileName.c_str(), "w"); + if (pemOut == NULL) + return error("GetPEM() : failed to create file %s\n", fileName.c_str()); + CKey key; + if (!GetKey(keyID, key)) + return error("GetPEM() : failed to get key for address=%s\n", CBitcoinAddress(keyID).ToString().c_str()); + bool result = key.WritePEM(pemOut, strPassKey); + BIO_free(pemOut); + return result; +} + int64_t CWallet::IncOrderPosNext(CWalletDB *pwalletdb) { int64_t nRet = nOrderPosNext++; @@ -750,7 +764,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl CWalletTx wtx(this,tx); // Get merkle branch if transaction was found in a block if (pblock) - wtx.SetMerkleBranch(pblock); + wtx.SetMerkleBranch(*pblock); return AddToWallet(wtx); } else @@ -942,7 +956,7 @@ void CWalletTx::GetAccountAmounts(const string& strAccount, int64_t& nGenerated, list > listSent; GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount, filter); - if (strAccount == "") + if (strAccount.empty()) nGenerated = allGeneratedMature; if (strAccount == strSentAccount) {