From 103849419a9c014a69c76b6f96e48b66cbc838ca Mon Sep 17 00:00:00 2001 From: s_nakamoto Date: Sat, 9 Oct 2010 19:33:35 +0000 Subject: key pool for safer wallet backup git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@163 1a98c847-1fd6-4fd8-948a-caf3550aa51b --- ui.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'ui.cpp') diff --git a/ui.cpp b/ui.cpp index a82365f36..d72e1a00a 100644 --- a/ui.cpp +++ b/ui.cpp @@ -1170,7 +1170,7 @@ void CMainFrame::OnButtonNew(wxCommandEvent& event) string strName = dialog.GetValue(); // Generate new key - string strAddress = PubKeyToAddress(GenerateNewKey()); + string strAddress = PubKeyToAddress(CWalletDB().GetKeyFromKeyPool()); // Save SetAddressBookName(strAddress, strName); @@ -1425,7 +1425,10 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails if (txout.IsMine()) strHTML += "Credit: " + FormatMoney(txout.GetCredit()) + "
"; - strHTML += "Inputs:
"; + strHTML += "
Transaction:
"; + strHTML += HtmlEscape(wtx.ToString(), true); + + strHTML += "
Inputs:
"; CRITICAL_BLOCK(cs_mapWallet) { foreach(const CTxIn& txin, wtx.vin) @@ -1444,9 +1447,6 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails } } } - - strHTML += "


Transaction:
"; - strHTML += HtmlEscape(wtx.ToString(), true); } @@ -2245,9 +2245,9 @@ void CSendingDialog::OnReply2(CDataStream& vRecv) Error(_("Insufficient funds")); return; } - CKey key; + CReserveKey reservekey; int64 nFeeRequired; - if (!CreateTransaction(scriptPubKey, nPrice, wtx, key, nFeeRequired)) + if (!CreateTransaction(scriptPubKey, nPrice, wtx, reservekey, nFeeRequired)) { if (nPrice + nFeeRequired > GetBalance()) Error(strprintf(_("This is an oversized transaction that requires a transaction fee of %s"), FormatMoney(nFeeRequired).c_str())); @@ -2287,7 +2287,7 @@ void CSendingDialog::OnReply2(CDataStream& vRecv) return; // Commit - if (!CommitTransaction(wtx, key)) + if (!CommitTransaction(wtx, reservekey)) { Error(_("The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.")); return; @@ -2565,7 +2565,7 @@ void CAddressBookDialog::OnButtonNew(wxCommandEvent& event) strName = dialog.GetValue(); // Generate new key - strAddress = PubKeyToAddress(GenerateNewKey()); + strAddress = PubKeyToAddress(CWalletDB().GetKeyFromKeyPool()); } // Add to list and select it -- cgit v1.2.3