What changed
Bitcoin v0.2.12 → v0.2.13
Release commit message: fixed colors on ubuntu lucid, enabled -O2 in makefile.unix, boost removed -mt from their library names in 1.40, updated bitcoin icon, hashmeter, generated and hashmeter log entries -- version 0.2.13
Previous diff: v0.2.11 → v0.2.12. Next: v0.2.13 → v0.3.0.
- main.cpp modified · +31 −2
- makefile.unix modified · +4 −4
- net.cpp modified · +1 −1
- net.h modified · +1 −1
- serialize.h modified · +1 −1
- ui.cpp modified · +6 −5
- uibase.cpp modified · +8 −14
- uibase.h modified · +2 −3
- util.cpp modified · +2 −4
main.cpp (modified)
1--- v0.2.12/main.cpp2+++ v0.2.13/main.cpp3@@ -2487,6 +2487,7 @@4 vnThreadsRunning[3]--;5 PrintException(NULL, "ThreadBitcoinMiner()");6 }7+ UIThreadCall(bind(CalledSetStatusBar, "", 0));8 printf("ThreadBitcoinMiner exiting, %d threads remaining\n", vnThreadsRunning[3]);9 }10 11@@ -2677,6 +2678,8 @@12 printf("BitcoinMiner:\n");13 printf("proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex().c_str(), hashTarget.GetHex().c_str());14 pblock->print();15+ printf("%s ", DateTimeStrFormat("%x %H:%M", GetTime()).c_str());16+ printf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue).c_str());17 18 SetThreadPriority(THREAD_PRIORITY_NORMAL);19 CRITICAL_BLOCK(cs_main)20@@ -2704,8 +2707,33 @@21 }22 23 // Update nTime every few seconds24- if ((++tmp.block.nNonce & 0xffff) == 0)25- {26+ const uint64 nMask = 0xffff;27+ if ((++tmp.block.nNonce & nMask) == 0)28+ {29+ // Meter hashes/sec30+ static int64 nHashCounter;31+ static int64 nLastTick;32+ if (nLastTick == 0)33+ nLastTick = GetTimeMillis();34+ else35+ nHashCounter += nMask + 1;36+ if (GetTimeMillis() - nLastTick > 4000)37+ {38+ double dHashesPerSec = 1000.0 * nHashCounter / (GetTimeMillis() - nLastTick);39+ nLastTick = GetTimeMillis();40+ nHashCounter = 0;41+ string strStatus = strprintf(" %.0f khash/s", dHashesPerSec/1000.0);42+ UIThreadCall(bind(CalledSetStatusBar, strStatus, 0));43+ static int64 nLogTime;44+ if (GetTime() - nLogTime > 60 * 60)45+ {46+ nLogTime = GetTime();47+ printf("%s ", DateTimeStrFormat("%x %H:%M", GetTime()).c_str());48+ printf("hashmeter %3d CPUs %6.0f khash/s\n", vnThreadsRunning[3], dHashesPerSec/1000.0);49+ }50+ }51+52+ // Check for stop or if block needs to be rebuilt53 if (fShutdown)54 return;55 if (!fGenerateBitcoins)56@@ -2738,6 +2766,7 @@57 }58 break;59 }60+61 tmp.block.nTime = pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());62 }63 }
makefile.unix (modified)
1--- v0.2.12/makefile.unix2+++ v0.2.13/makefile.unix3@@ -21,7 +21,7 @@4 5 LIBS= \6 -Wl,-Bstatic \7- -l boost_system-mt -l boost_filesystem-mt \8+ -l boost_system -l boost_filesystem \9 -l db_cxx \10 -Wl,-Bdynamic \11 -l crypto \12@@ -29,7 +29,7 @@13 14 WXDEFS=-D__WXGTK__ -DNOPCH15 DEBUGFLAGS=-g -D__WXDEBUG__16-CFLAGS=-O0 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)17+CFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)18 HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \19 script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h20 21@@ -68,7 +68,7 @@22 23 24 clean:25- -rm obj/*26- -rm obj/nogui/*27+ -rm obj/*.o28+ -rm obj/nogui/*.o29 -rm headers.h.gch30
net.cpp (modified)
1--- v0.2.12/net.cpp2+++ v0.2.13/net.cpp3@@ -965,7 +965,7 @@4 int64 nSinceLastTry = GetAdjustedTime() - addr.nLastTry;5 6 // Randomize the order in a deterministic way, putting the standard port first7- int64 nRandomizer = (uint64)(nStart + addr.nLastTry * 9567851 + addr.ip * 7789) % (2 * 60 * 60);8+ int64 nRandomizer = (uint64)(nStart * 4951 + addr.nLastTry * 9567851 + addr.ip * 7789) % (2 * 60 * 60);9 if (addr.port != DEFAULT_PORT)10 nRandomizer += 2 * 60 * 60;11
net.h (modified)
1--- v0.2.12/net.h2+++ v0.2.13/net.h3@@ -12,7 +12,7 @@4 5 6 7-#define DEFAULT_PORT htons(8333)8+static const unsigned short DEFAULT_PORT = 0x8d20; // htons(8333)9 static const unsigned int PUBLISH_HOPS = 5;10 enum11 {
serialize.h (modified)
1--- v0.2.12/serialize.h2+++ v0.2.13/serialize.h3@@ -19,7 +19,7 @@4 class CDataStream;5 class CAutoFile;6 7-static const int VERSION = 212;8+static const int VERSION = 213;9 static const char* pszSubVer = "";10 11
ui.cpp (modified)
1--- v0.2.12/ui.cpp2+++ v0.2.13/ui.cpp3@@ -250,7 +250,8 @@4 #ifdef __WXMSW__5 SetIcon(wxICON(bitcoin));6 #else7- SetIcon(bitcoin16_xpm);8+ SetIcon(bitcoin20_xpm);9+ SetBackgroundColour(m_toolBar->GetBackgroundColour());10 wxFont fontTmp = m_staticText41->GetFont();11 fontTmp.SetFamily(wxFONTFAMILY_TELETYPE);12 m_staticTextBalance->SetFont(fontTmp);13@@ -374,13 +375,13 @@14 // to get rid of the deprecated warning. Just ignore it.15 if (!event.Iconized())16 fClosedToTray = false;17-#ifndef __WXMSW__18- // Tray is not reliable on ubuntu 9.10 gnome19- fClosedToTray = false;20-#endif21+#ifdef __WXMSW__22+ // The tray icon sometimes disappears on ubuntu karmic23+ // Hiding the taskbar button doesn't work reliably on ubuntu lucid24 if (fMinimizeToTray && event.Iconized())25 fClosedToTray = true;26 Show(!fClosedToTray);27+#endif28 ptaskbaricon->Show(fMinimizeToTray || fClosedToTray);29 }30
uibase.cpp (modified)
1--- v0.2.12/uibase.cpp2+++ v0.2.13/uibase.cpp3@@ -20,8 +20,6 @@4 this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );5 6 m_menubar = new wxMenuBar( 0 );7- m_menubar->SetBackgroundColour( wxColour( 240, 240, 240 ) );8- 9 m_menuFile = new wxMenu();10 wxMenuItem* m_menuFileExit;11 m_menuFileExit = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( _("E&xit") ) , wxEmptyString, wxITEM_NORMAL );12@@ -95,25 +93,21 @@13 wxBoxSizer* bSizer3;14 bSizer3 = new wxBoxSizer( wxHORIZONTAL );15 16- m_panel14 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );17 wxBoxSizer* bSizer66;18 bSizer66 = new wxBoxSizer( wxHORIZONTAL );19 20- m_staticText41 = new wxStaticText( m_panel14, wxID_ANY, _("Balance:"), wxDefaultPosition, wxSize( -1,15 ), 0 );21+ m_staticText41 = new wxStaticText( this, wxID_ANY, _("Balance:"), wxDefaultPosition, wxSize( -1,15 ), 0 );22 m_staticText41->Wrap( -1 );23 bSizer66->Add( m_staticText41, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );24 25- m_staticTextBalance = new wxStaticText( m_panel14, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 120,15 ), wxALIGN_RIGHT|wxST_NO_AUTORESIZE );26+ m_staticTextBalance = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 120,15 ), wxALIGN_RIGHT|wxST_NO_AUTORESIZE );27 m_staticTextBalance->Wrap( -1 );28 m_staticTextBalance->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) );29 m_staticTextBalance->SetBackgroundColour( wxColour( 255, 255, 255 ) );30 31 bSizer66->Add( m_staticTextBalance, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );32 33- m_panel14->SetSizer( bSizer66 );34- m_panel14->Layout();35- bSizer66->Fit( m_panel14 );36- bSizer3->Add( m_panel14, 1, wxEXPAND|wxALIGN_BOTTOM|wxALL, 5 );37+ bSizer3->Add( bSizer66, 1, wxEXPAND|wxALL, 5 );38 39 40 bSizer3->Add( 0, 0, 0, wxEXPAND, 5 );41@@ -560,12 +554,12 @@42 43 bSizer631->Add( 0, 4, 0, wxEXPAND, 5 );44 45- m_staticTextMain = new wxStaticText( this, wxID_ANY, _("Copyright (c) 2009-2010 Satoshi Nakamoto.\n\nThis is experimental software. Do not rely on it for actual financial transactions.\n\nDistributed under the MIT/X11 software license, see the accompanying file \nlicense.txt or http://www.opensource.org/licenses/mit-license.php.\n\nThis product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \nEric Young (eay@cryptsoft.com)."), wxDefaultPosition, wxDefaultSize, 0 );46+ m_staticTextMain = new wxStaticText( this, wxID_ANY, _("Copyright (c) 2009-2010 Satoshi Nakamoto.\n\nDistributed under the MIT/X11 software license, see the accompanying file \nlicense.txt or http://www.opensource.org/licenses/mit-license.php.\n\nThis product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \nEric Young (eay@cryptsoft.com)."), wxDefaultPosition, wxDefaultSize, 0 );47 m_staticTextMain->Wrap( -1 );48 bSizer631->Add( m_staticTextMain, 0, wxALL, 5 );49 50 51- bSizer631->Add( 0, 0, 1, wxEXPAND, 5 );52+ bSizer631->Add( 0, 0, 0, wxEXPAND, 5 );53 54 bSizer62->Add( bSizer631, 1, wxEXPAND, 5 );55 56@@ -578,9 +572,9 @@57 bSizer61->Add( 0, 0, 1, wxEXPAND, 5 );58 59 m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( -1,-1 ), 0 );60- bSizer61->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );61- 62- bSizer60->Add( bSizer61, 0, wxALIGN_RIGHT|wxEXPAND|wxRIGHT, 5 );63+ bSizer61->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 6 );64+ 65+ bSizer60->Add( bSizer61, 0, wxALIGN_RIGHT|wxEXPAND|wxRIGHT, 2 );66 67 bSizer63->Add( bSizer60, 1, wxEXPAND|wxLEFT, 5 );68
uibase.h (modified)
1--- v0.2.12/uibase.h2+++ v0.2.13/uibase.h3@@ -25,9 +25,9 @@4 #include <wx/textctrl.h>5 #include <wx/button.h>6 #include <wx/sizer.h>7-#include <wx/panel.h>8 #include <wx/choice.h>9 #include <wx/listctrl.h>10+#include <wx/panel.h>11 #include <wx/notebook.h>12 #include <wx/frame.h>13 #include <wx/html/htmlwin.h>14@@ -82,7 +82,6 @@15 wxButton* m_buttonNew;16 wxButton* m_buttonCopy;17 18- wxPanel* m_panel14;19 wxStaticText* m_staticText41;20 wxStaticText* m_staticTextBalance;21 22@@ -228,7 +227,7 @@23 24 public:25 wxStaticText* m_staticTextVersion;26- CAboutDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 532,329 ), long style = wxDEFAULT_DIALOG_STYLE );27+ CAboutDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 532,315 ), long style = wxDEFAULT_DIALOG_STYLE );28 ~CAboutDialogBase();29 30 };
util.cpp (modified)
1--- v0.2.12/util.cpp2+++ v0.2.13/util.cpp3@@ -101,10 +101,8 @@4 hash = 0;5 memset(pdata, 0, nSize);6 7- printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str(), nSize);8- }9-#else10- printf("%s RandAddSeed()\n", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());11+ printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M", GetTime()).c_str(), nSize);12+ }13 #endif14 }15
