}\r
}\r
\r
- // Notify UI to update prev block coinbase if it was ours\r
- vWalletUpdated.push_back(hashBestChain);\r
-\r
// New best link\r
hashBestChain = hash;\r
pindexBest = pindexNew;\r
txdb.TxnCommit();\r
txdb.Close();\r
\r
- // Relay wallet transactions that haven't gotten in yet\r
if (pindexNew == pindexBest)\r
+ {\r
+ // Relay wallet transactions that haven't gotten in yet\r
RelayWalletTransactions();\r
\r
+ // Notify UI to display prev block's coinbase if it was ours\r
+ static uint256 hashPrevBestCoinBase;\r
+ CRITICAL_BLOCK(cs_mapWallet)\r
+ vWalletUpdated.push_back(hashPrevBestCoinBase);\r
+ hashPrevBestCoinBase = vtx[0].GetHash();\r
+ }\r
+\r
MainFrameRepaint();\r
return true;\r
}\r
else\r
{\r
// Ignore unknown commands for extensibility\r
- printf("ProcessMessage(%s) : Ignored unknown message\n", strCommand.c_str());\r
}\r
\r
-\r
- if (!vRecv.empty())\r
- printf("ProcessMessage(%s) : %d extra bytes\n", strCommand.c_str(), vRecv.size());\r
-\r
return true;\r
}\r
\r
}\r
pblock->nBits = nBits;\r
pblock->vtx[0].vout[0].nValue = pblock->GetBlockValue(nFees);\r
- printf("\n\nRunning BitcoinMiner with %d transactions in block\n", pblock->vtx.size());\r
+ printf("Running BitcoinMiner with %d transactions in block\n", pblock->vtx.size());\r
\r
\r
//\r
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);\r
CRITICAL_BLOCK(cs_main)\r
{\r
- if (pindexPrev != pindexBest)\r
+ if (pindexPrev == pindexBest)\r
{\r
- SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_LOWEST);\r
- break;\r
+ // Save key\r
+ if (!AddKey(key))\r
+ return false;\r
+ key.MakeNewKey();\r
+\r
+ // Process this block the same as if we had received it from another node\r
+ if (!ProcessBlock(NULL, pblock.release()))\r
+ printf("ERROR in BitcoinMiner, ProcessBlock, block not accepted\n");\r
}\r
-\r
- // Save key\r
- if (!AddKey(key))\r
- return false;\r
- key.MakeNewKey();\r
-\r
- // Process this block the same as if we had received it from another node\r
- if (!ProcessBlock(NULL, pblock.release()))\r
- printf("ERROR in BitcoinMiner, ProcessBlock, block not accepted\n");\r
}\r
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_LOWEST);\r
\r
break;\r
if (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60)\r
break;\r
- if (!fGenerateBitcoins)\r
+ if (vNodes.empty())\r
break;\r
+ if (!fGenerateBitcoins)\r
+ return true;\r
if (fLimitProcessors && vnThreadsRunning[3] > nLimitProcessors)\r
return true;\r
tmp.block.nTime = pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());\r
\r
// Init column headers\r
int nDateWidth = DateTimeStr(1229413914).size() * 6 + 8;\r
+ if (!strstr(DateTimeStr(1229413914).c_str(), "2008"))\r
+ nDateWidth += 12;\r
m_listCtrl->InsertColumn(0, "", wxLIST_FORMAT_LEFT, 0);\r
m_listCtrl->InsertColumn(1, "", wxLIST_FORMAT_LEFT, 0);\r
m_listCtrl->InsertColumn(2, "Status", wxLIST_FORMAT_LEFT, 90);\r
m_listCtrl->SetItemData(nIndex, nData);\r
}\r
\r
+bool CMainFrame::DeleteLine(uint256 hashKey)\r
+{\r
+ long nData = *(long*)&hashKey;\r
+\r
+ // Find item\r
+ int nIndex = -1;\r
+ while ((nIndex = m_listCtrl->FindItem(nIndex, nData)) != -1)\r
+ if (GetItemText(m_listCtrl, nIndex, 1) == hashKey.ToString())\r
+ break;\r
+\r
+ if (nIndex != -1)\r
+ m_listCtrl->DeleteItem(nIndex);\r
+\r
+ return nIndex != -1;\r
+}\r
+\r
string FormatTxStatus(const CWalletTx& wtx)\r
{\r
// Status\r
int nDepth = wtx.GetDepthInMainChain();\r
if (!wtx.IsFinal())\r
- return strprintf("Open for %d blocks", nBestHeight - wtx.nLockTime);\r
+ {\r
+ if (wtx.nLockTime < 500000000)\r
+ return strprintf("Open for %d blocks", nBestHeight - wtx.nLockTime);\r
+ else\r
+ return strprintf("Open until %s", DateTimeStr(wtx.nLockTime).c_str());\r
+ }\r
else if (nDepth < 6)\r
return strprintf("%d/unconfirmed", nDepth);\r
else\r
// are special because if their block is not accepted, they are not valid.\r
//\r
if (wtx.GetDepthInMainChain() < 2)\r
+ {\r
+ // In case it was previously displayed\r
+ DeleteLine(hash);\r
return;\r
+ }\r
}\r
\r
// Find the block the tx is in\r
event.Skip();\r
}\r
\r
+void DelayedRepaint(void* parg)\r
+{\r
+ static bool fOneThread;\r
+ if (fOneThread)\r
+ return;\r
+ fOneThread = true;\r
+ Sleep(1000);\r
+ MainFrameRepaint();\r
+ fOneThread = false;\r
+}\r
+\r
void CMainFrame::OnPaintListCtrl(wxPaintEvent& event)\r
{\r
// Update listctrl contents\r
// Update status bar\r
string strGen = "";\r
if (fGenerateBitcoins)\r
- strGen = " Generating";\r
+ strGen = " Generating";\r
if (fGenerateBitcoins && vNodes.empty())\r
strGen = "(not connected)";\r
m_statusBar->SetStatusText(strGen, 1);\r
m_statusBar->SetStatusText(strStatus, 2);\r
\r
// Balance total\r
+ bool fRefreshed = false;\r
TRY_CRITICAL_BLOCK(cs_mapWallet)\r
+ {\r
m_staticTextBalance->SetLabel(FormatMoney(GetBalance()) + " ");\r
+ fRefreshed = true;\r
+ }\r
+\r
+ // mapWallet was locked, try again later\r
+ if (!vWalletUpdated.empty() || !fRefreshed)\r
+ _beginthread(DelayedRepaint, 0, NULL);\r
\r
m_listCtrl->OnPaint(event);\r
}\r
\r
CAboutDialog::CAboutDialog(wxWindow* parent) : CAboutDialogBase(parent)\r
{\r
- m_staticTextVersion->SetLabel(strprintf("version 0.%d.%d Alpha", VERSION/100, VERSION%100));\r
+ m_staticTextVersion->SetLabel(strprintf("version 0.%d.%d Beta", VERSION/100, VERSION%100));\r
\r
// Workaround until upgrade to wxWidgets supporting UTF-8\r
wxString str = m_staticTextMain->GetLabel();\r
return false;\r
}\r
\r
+ //RandAddSeedPerfmon();\r
+\r
if (!StartNode(strErrors))\r
wxMessageBox(strErrors, "Bitcoin");\r
\r
// Get the current executable path\r
char pszExePath[MAX_PATH];\r
GetModuleFileName(NULL, pszExePath, sizeof(pszExePath));\r
- _strlwr(pszExePath);\r
\r
// Set the path to the shortcut target\r
psl->SetPath(pszExePath);\r