retry IRC if name in use,

resize to fit ubuntu's giant default font, 
scroll debug.log, 
pause gen during initial block download

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@44 1a98c847-1fd6-4fd8-948a-caf3550aa51b
This commit is contained in:
s_nakamoto 2009-12-11 16:49:21 +00:00
parent b075bbf986
commit 4ea3f3da1a
13 changed files with 187 additions and 89 deletions

View File

@ -9,7 +9,7 @@ cryptographic software written by Eric Young (eay@cryptsoft.com).
WINDOWS BUILD NOTES
===================
Compilers Supported
-------------------
@ -19,7 +19,7 @@ Microsoft Visual C++ 6.0 SP6
Dependencies
------------
Libraries you need to obtain separately to build:
Libraries you need to download separately and build:
default path download
wxWidgets \wxwidgets http://www.wxwidgets.org/downloads/
@ -44,7 +44,7 @@ Boost 1.34.1
Notes
-----
The UI layout is edited with wxFormBuilder. Open the project file
The UI layout is edited with wxFormBuilder. The project file is
uiproject.fbp. It generates uibase.cpp and uibase.h, which define base
classes that do the rote work of constructing all the UI elements.

View File

@ -9,7 +9,7 @@ cryptographic software written by Eric Young (eay@cryptsoft.com).
UNIX BUILD NOTES
================
Dependencies
------------
@ -20,11 +20,10 @@ apt-get install libdb4.7-dev
apt-get install libdb4.7++-dev
apt-get install libboost-dev
Libraries you need to obtain separately and build:
default path download
wxWidgets \wxwidgets http://www.wxwidgets.org/downloads/
You need to download wxWidgets from http://www.wxwidgets.org/downloads/
and build it yourself.
Licenses:
Licenses of statically linked libraries:
wxWidgets LGPL 2.1 with very liberal exceptions
Berkeley DB New BSD license with additional requirement that linked software must be free open source
Boost MIT-like license
@ -39,7 +38,7 @@ Boost 1.40.0
Notes
-----
The UI layout is edited with wxFormBuilder. Open the project file
The UI layout is edited with wxFormBuilder. The project file is
uiproject.fbp. It generates uibase.cpp and uibase.h, which define base
classes that do the rote work of constructing all the UI elements.
@ -61,7 +60,7 @@ ldconfig
Boost
-----
If you download and build Boost yourself
If you want to build Boost yourself,
cd /usr/local/boost_1_40_0
su
./bootstrap.sh

21
db.cpp
View File

@ -445,7 +445,7 @@ bool CAddrDB::LoadAddresses()
CRITICAL_BLOCK(cs_mapAddresses)
{
// Load user provided addresses
CAutoFile filein = fopen("addr.txt", "rt");
CAutoFile filein = fopen((GetDataDir() + "/addr.txt").c_str(), "rt");
if (filein)
{
try
@ -536,10 +536,11 @@ bool CReviewDB::WriteReviews(uint256 hash, const vector<CReview>& vReviews)
bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet)
{
vchDefaultKeyRet.clear();
int nFileVersion = 0;
// Modify defaults
#ifndef __WXMSW__
// Reports that tray icon can disappear on gnome, leaving no way to access the program
// Tray icon sometimes disappears on 9.10 karmic koala 64-bit, leaving no way to access the program
fMinimizeToTray = false;
fMinimizeOnClose = false;
#endif
@ -607,6 +608,10 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet)
{
ssValue >> vchDefaultKeyRet;
}
else if (strType == "version")
{
ssValue >> nFileVersion;
}
else if (strType == "setting")
{
string strKey;
@ -649,6 +654,16 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet)
WriteSetting("nTransactionFee", nTransactionFee);
}
// Upgrade
if (nFileVersion < VERSION)
{
// Get rid of old debug.log file in current directory
if (nFileVersion <= 105 && !pszSetDataDir[0])
unlink("debug.log");
WriteVersion(VERSION);
}
return true;
}
@ -656,7 +671,7 @@ bool LoadWallet(bool& fFirstRunRet)
{
fFirstRunRet = false;
vector<unsigned char> vchDefaultKey;
if (!CWalletDB("cr").LoadWallet(vchDefaultKey))
if (!CWalletDB("cr+").LoadWallet(vchDefaultKey))
return false;
fFirstRunRet = vchDefaultKey.empty();

23
irc.cpp
View File

@ -121,20 +121,20 @@ bool RecvLineIRC(SOCKET hSocket, string& strLine)
}
}
bool RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL)
int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL)
{
loop
{
string strLine;
if (!RecvLineIRC(hSocket, strLine))
return false;
return 0;
printf("IRC %s\n", strLine.c_str());
if (psz1 && strLine.find(psz1) != -1)
return true;
return 1;
if (psz2 && strLine.find(psz2) != -1)
return true;
return 2;
if (psz3 && strLine.find(psz3) != -1)
return true;
return 3;
}
}
@ -159,6 +159,7 @@ void ThreadIRCSeed(void* parg)
SetThreadPriority(THREAD_PRIORITY_NORMAL);
int nErrorWait = 10;
int nRetryWait = 10;
bool fNameInUse = false;
bool fTOR = (fUseProxy && addrProxy.port == htons(9050));
while (!fShutdown)
@ -194,7 +195,7 @@ void ThreadIRCSeed(void* parg)
}
string strMyName;
if (addrLocalHost.IsRoutable() && !fUseProxy)
if (addrLocalHost.IsRoutable() && !fUseProxy && !fNameInUse)
strMyName = EncodeAddress(addrLocalHost);
else
strMyName = strprintf("x%u", GetRand(1000000000));
@ -203,10 +204,18 @@ void ThreadIRCSeed(void* parg)
Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str());
Send(hSocket, strprintf("USER %s 8 * : %s\r", strMyName.c_str(), strMyName.c_str()).c_str());
if (!RecvUntil(hSocket, " 004 "))
int nRet = RecvUntil(hSocket, " 004 ", " 433 ");
if (nRet != 1)
{
closesocket(hSocket);
hSocket = INVALID_SOCKET;
if (nRet == 2)
{
printf("IRC name already in use\n");
fNameInUse = true;
Wait(10);
continue;
}
nErrorWait = nErrorWait * 11 / 10;
if (Wait(nErrorWait += 60))
continue;

View File

@ -2530,7 +2530,7 @@ void BitcoinMiner()
//
// Search
//
unsigned int nStart = GetTime();
int64 nStart = GetTime();
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
uint256 hash;
loop
@ -2582,14 +2582,27 @@ void BitcoinMiner()
return;
if (fLimitProcessors && vnThreadsRunning[3] > nLimitProcessors)
return;
if (tmp.block.nNonce == 0)
if (vNodes.empty())
break;
if (pindexPrev != pindexBest)
if (tmp.block.nNonce == 0)
break;
if (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60)
break;
if (vNodes.empty())
if (pindexPrev != pindexBest)
{
// Pause generating during initial download
if (GetTime() - nStart < 20)
{
CBlockIndex* pindexTmp;
do
{
pindexTmp = pindexBest;
Sleep(10000);
}
while (pindexTmp != pindexBest);
}
break;
}
tmp.block.nTime = pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
}
}

View File

@ -10,8 +10,6 @@ endif
endif
ifeq "$(BUILD)" "debug"
D=d
# note: gcc 3.x profile doesn't work
#DEBUGFLAGS=-O0 -g -pg -D__WXDEBUG__
DEBUGFLAGS=-g -D__WXDEBUG__
endif
@ -36,34 +34,34 @@ all: bitcoin.exe
headers.h.gch: headers.h $(HEADERS) net.h irc.h market.h uibase.h ui.h
g++ -c $(CFLAGS) -o $@ $<
obj/util.o: util.cpp $(HEADERS)
obj/util.o: util.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/script.o: script.cpp $(HEADERS)
obj/script.o: script.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/db.o: db.cpp $(HEADERS) market.h
obj/db.o: db.cpp $(HEADERS) market.h
g++ -c $(CFLAGS) -o $@ $<
obj/net.o: net.cpp $(HEADERS) net.h
obj/net.o: net.cpp $(HEADERS) net.h
g++ -c $(CFLAGS) -o $@ $<
obj/main.o: main.cpp $(HEADERS) net.h market.h sha.h
obj/main.o: main.cpp $(HEADERS) net.h market.h sha.h
g++ -c $(CFLAGS) -o $@ $<
obj/market.o: market.cpp $(HEADERS) market.h
obj/market.o: market.cpp $(HEADERS) market.h
g++ -c $(CFLAGS) -o $@ $<
obj/ui.o: ui.cpp $(HEADERS) net.h uibase.h ui.h market.h
obj/ui.o: ui.cpp $(HEADERS) net.h uibase.h ui.h market.h
g++ -c $(CFLAGS) -o $@ $<
obj/uibase.o: uibase.cpp uibase.h
obj/uibase.o: uibase.cpp uibase.h
g++ -c $(CFLAGS) -o $@ $<
obj/sha.o: sha.cpp sha.h
obj/sha.o: sha.cpp sha.h
g++ -c $(CFLAGS) -O3 -o $@ $<
obj/irc.o: irc.cpp $(HEADERS)
obj/irc.o: irc.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/ui_res.o: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp rc/send16masknoshadow.bmp rc/send20.bmp rc/send20mask.bmp rc/addressbook16.bmp rc/addressbook16mask.bmp rc/addressbook20.bmp rc/addressbook20mask.bmp
@ -71,8 +69,8 @@ obj/ui_res.o: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp
OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o obj/market.o \
obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/ui_res.o
OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o obj/market.o \
obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/ui_res.o
bitcoin.exe: headers.h.gch $(OBJS)
-kill /f bitcoin.exe

View File

@ -22,13 +22,16 @@ INCLUDEPATHS= \
LIBPATHS= \
-L"/usr/lib" \
-L"/usr/local/lib" \
-L"/usr/local/lib"
LIBS= \
-Wl,-Bstatic -l boost_system -l boost_filesystem -Wl,-Bdynamic \
-Wl,-Bstatic -l db_cxx -l wx_gtk2$(D)-2.8 -Wl,-Bdynamic \
-l crypto \
-l gtk-x11-2.0 -l gthread-2.0 -l SM
-Wl,-Bstatic \
-l boost_system -l boost_filesystem \
-l db_cxx \
-l wx_gtk2$(D)-2.8 \
-Wl,-Bdynamic \
-l crypto \
-l gtk-x11-2.0 -l gthread-2.0 -l SM
WXDEFS=-D__WXGTK__ -DNOPCH
CFLAGS=-O0 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
@ -42,41 +45,41 @@ all: bitcoin
headers.h.gch: headers.h $(HEADERS) net.h irc.h market.h uibase.h ui.h
g++ -c $(CFLAGS) -o $@ $<
obj/util.o: util.cpp $(HEADERS)
obj/util.o: util.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/script.o: script.cpp $(HEADERS)
obj/script.o: script.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/db.o: db.cpp $(HEADERS) market.h
obj/db.o: db.cpp $(HEADERS) market.h
g++ -c $(CFLAGS) -o $@ $<
obj/net.o: net.cpp $(HEADERS) net.h
obj/net.o: net.cpp $(HEADERS) net.h
g++ -c $(CFLAGS) -o $@ $<
obj/main.o: main.cpp $(HEADERS) net.h market.h sha.h
obj/main.o: main.cpp $(HEADERS) net.h market.h sha.h
g++ -c $(CFLAGS) -o $@ $<
obj/market.o: market.cpp $(HEADERS) market.h
obj/market.o: market.cpp $(HEADERS) market.h
g++ -c $(CFLAGS) -o $@ $<
obj/ui.o: ui.cpp $(HEADERS) net.h uibase.h ui.h market.h
obj/ui.o: ui.cpp $(HEADERS) net.h uibase.h ui.h market.h
g++ -c $(CFLAGS) -o $@ $<
obj/uibase.o: uibase.cpp uibase.h
obj/uibase.o: uibase.cpp uibase.h
g++ -c $(CFLAGS) -o $@ $<
obj/sha.o: sha.cpp sha.h
obj/sha.o: sha.cpp sha.h
g++ -c $(CFLAGS) -O3 -o $@ $<
obj/irc.o: irc.cpp $(HEADERS)
obj/irc.o: irc.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o obj/market.o \
obj/ui.o obj/uibase.o obj/sha.o obj/irc.o
obj/ui.o obj/uibase.o obj/sha.o obj/irc.o
bitcoin: headers.h.gch $(OBJS)
g++ $(CFLAGS) -o $@ $(LIBPATHS) $(OBJS) $(LIBS)

25
net.cpp
View File

@ -21,7 +21,6 @@ uint64 nLocalServices = (fClient ? 0 : NODE_NETWORK);
CAddress addrLocalHost(0, DEFAULT_PORT, nLocalServices);
CNode* pnodeLocalHost = NULL;
uint64 nLocalHostNonce = 0;
bool fShutdown = false;
array<int, 10> vnThreadsRunning;
SOCKET hListenSocket = INVALID_SOCKET;
int64 nThreadSocketHandlerHeartbeat = INT64_MAX;
@ -1324,3 +1323,27 @@ bool StopNode()
return true;
}
class CNetCleanup
{
public:
CNetCleanup()
{
}
~CNetCleanup()
{
// Close sockets
foreach(CNode* pnode, vNodes)
if (pnode->hSocket != INVALID_SOCKET)
closesocket(pnode->hSocket);
if (hListenSocket != INVALID_SOCKET)
if (closesocket(hListenSocket) == SOCKET_ERROR)
printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError());
#ifdef __WXMSW__
// Shutdown Windows Sockets
WSACleanup();
#endif
}
}
instance_of_cnetcleanup;

1
net.h
View File

@ -454,7 +454,6 @@ extern uint64 nLocalServices;
extern CAddress addrLocalHost;
extern CNode* pnodeLocalHost;
extern uint64 nLocalHostNonce;
extern bool fShutdown;
extern array<int, 10> vnThreadsRunning;
extern SOCKET hListenSocket;
extern int64 nThreadSocketHandlerHeartbeat;

View File

@ -20,7 +20,7 @@ class CDataStream;
class CAutoFile;
static const int VERSION = 106;
static const char* pszSubVer = " test10";
static const char* pszSubVer = " test11";

46
ui.cpp
View File

@ -317,6 +317,7 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent)
fOnSetFocusAddress = false;
fRefresh = false;
m_choiceFilter->SetSelection(0);
double dResize = 1.0;
#ifdef __WXMSW__
SetIcon(wxICON(bitcoin));
#else
@ -330,6 +331,10 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent)
m_toolBar->AddTool(wxID_BUTTONSEND, "Send Coins", wxBitmap(send20_xpm), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
m_toolBar->AddTool(wxID_BUTTONRECEIVE, "Address Book", wxBitmap(addressbook20_xpm), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
m_toolBar->Realize();
// resize to fit ubuntu's huge default font
dResize = 1.19;
SetSize(dResize * GetSize().GetWidth(), 1.1 * GetSize().GetHeight());
dResize = 1.20;
#endif
m_staticTextBalance->SetLabel(FormatMoney(GetBalance()) + " ");
m_listCtrl->SetFocus();
@ -339,13 +344,13 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent)
int nDateWidth = DateTimeStr(1229413914).size() * 6 + 8;
if (!strstr(DateTimeStr(1229413914).c_str(), "2008"))
nDateWidth += 12;
m_listCtrl->InsertColumn(0, "", wxLIST_FORMAT_LEFT, 0);
m_listCtrl->InsertColumn(1, "", wxLIST_FORMAT_LEFT, 0);
m_listCtrl->InsertColumn(2, "Status", wxLIST_FORMAT_LEFT, 90);
m_listCtrl->InsertColumn(3, "Date", wxLIST_FORMAT_LEFT, nDateWidth);
m_listCtrl->InsertColumn(4, "Description", wxLIST_FORMAT_LEFT, 409 - nDateWidth);
m_listCtrl->InsertColumn(5, "Debit", wxLIST_FORMAT_RIGHT, 79);
m_listCtrl->InsertColumn(6, "Credit", wxLIST_FORMAT_RIGHT, 79);
m_listCtrl->InsertColumn(0, "", wxLIST_FORMAT_LEFT, dResize * 0);
m_listCtrl->InsertColumn(1, "", wxLIST_FORMAT_LEFT, dResize * 0);
m_listCtrl->InsertColumn(2, "Status", wxLIST_FORMAT_LEFT, dResize * 90);
m_listCtrl->InsertColumn(3, "Date", wxLIST_FORMAT_LEFT, dResize * nDateWidth);
m_listCtrl->InsertColumn(4, "Description", wxLIST_FORMAT_LEFT, dResize * 409 - nDateWidth);
m_listCtrl->InsertColumn(5, "Debit", wxLIST_FORMAT_RIGHT, dResize * 79);
m_listCtrl->InsertColumn(6, "Credit", wxLIST_FORMAT_RIGHT, dResize * 79);
//m_listCtrlProductsSent->InsertColumn(0, "Category", wxLIST_FORMAT_LEFT, 100);
//m_listCtrlProductsSent->InsertColumn(1, "Title", wxLIST_FORMAT_LEFT, 100);
@ -367,6 +372,10 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent)
// Init status bar
int pnWidths[3] = { -100, 88, 290 };
#ifndef __WXMSW__
pnWidths[1] = pnWidths[1] * 1.1 * dResize;
pnWidths[2] = pnWidths[2] * 1.1 * dResize;
#endif
m_statusBar->SetFieldsCount(3, pnWidths);
// Fill your address text box
@ -1514,6 +1523,7 @@ COptionsDialog::COptionsDialog(wxWindow* parent) : COptionsDialogBase(parent)
SelectPage(0);
#ifndef __WXMSW__
m_checkBoxMinimizeOnClose->SetLabel("&Minimize on close");
m_checkBoxStartOnSystemStartup->Enable(false); // not implemented yet
#endif
// Init values
@ -1876,6 +1886,9 @@ CSendingDialog::CSendingDialog(wxWindow* parent, const CAddress& addrIn, int64 n
fSuccess = false;
fUIDone = false;
fWorkDone = false;
#ifndef __WXMSW__
SetSize(1.2 * GetSize().GetWidth(), 1.05 * GetSize().GetHeight());
#endif
SetTitle(strprintf("Sending %s to %s", FormatMoney(nPrice).c_str(), wtx.mapValue["to"].c_str()));
m_textCtrlStatus->SetValue("");
@ -3475,6 +3488,7 @@ bool CMyApp::OnInit2()
ParseParameters(argc, argv);
if (mapArgs.count("-?") || mapArgs.count("--help"))
{
#ifdef __WXMSW__
string strUsage =
"Usage: bitcoin [options]\t\t\t\t\t\t\n"
"Options:\n"
@ -3487,6 +3501,20 @@ bool CMyApp::OnInit2()
" -connect=<ip>\t Connect only to the specified node\n"
" -?\t\t This help message\n";
wxMessageBox(strUsage, "Bitcoin", wxOK);
#else
string strUsage =
"Usage: bitcoin [options]\n"
"Options:\n"
" -gen Generate coins\n"
" -gen=0 Don't generate coins\n"
" -min Start minimized\n"
" -datadir=<dir> Specify data directory\n"
" -proxy=<ip:port> Connect through socks4 proxy\n"
" -addnode=<ip> Add a node to connect to\n"
" -connect=<ip> Connect only to the specified node\n"
" -? This help message\n";
fprintf(stderr, "%s", strUsage.c_str());
#endif
return false;
}
@ -3495,12 +3523,12 @@ bool CMyApp::OnInit2()
if (mapArgs.count("-debug"))
fDebug = true;
if (strstr(pszSubVer, "test"))
fDebug = true;
if (mapArgs.count("-printtodebugger"))
fPrintToDebugger = true;
if (!fDebug && !pszSetDataDir[0])
ShrinkDebugFile();
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf("Bitcoin version %d%s, OS version %s\n", VERSION, pszSubVer, wxGetOsDescription().mb_str());

View File

@ -11,6 +11,7 @@ bool fDebug = false;
bool fPrintToDebugger = false;
bool fPrintToConsole = false;
char pszSetDataDir[MAX_PATH] = "";
bool fShutdown = false;
@ -53,19 +54,6 @@ public:
for (int i = 0; i < CRYPTO_num_locks(); i++)
delete ppmutexOpenSSL[i];
OPENSSL_free(ppmutexOpenSSL);
// Close sockets
foreach(CNode* pnode, vNodes)
if (pnode->hSocket != INVALID_SOCKET)
closesocket(pnode->hSocket);
if (hListenSocket != INVALID_SOCKET)
if (closesocket(hListenSocket) == SOCKET_ERROR)
printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError());
#ifdef __WXMSW__
// Shutdown Windows Sockets
WSACleanup();
#endif
}
}
instance_of_cinit;
@ -416,16 +404,6 @@ void PrintException(std::exception* pex, const char* pszThread)
int GetFilesize(FILE* file)
{
int nSavePos = ftell(file);
int nFilesize = -1;
if (fseek(file, 0, SEEK_END) == 0)
nFilesize = ftell(file);
fseek(file, nSavePos, SEEK_SET);
return nFilesize;
}
void GetDataDir(char* pszDir)
{
// pszDir must be at least MAX_PATH length.
@ -465,6 +443,37 @@ string GetDataDir()
return pszDir;
}
int GetFilesize(FILE* file)
{
int nSavePos = ftell(file);
int nFilesize = -1;
if (fseek(file, 0, SEEK_END) == 0)
nFilesize = ftell(file);
fseek(file, nSavePos, SEEK_SET);
return nFilesize;
}
void ShrinkDebugFile()
{
// Scroll debug.log if it's getting too big
string strFile = GetDataDir() + "/debug.log";
FILE* file = fopen(strFile.c_str(), "r");
if (file && GetFilesize(file) > 10 * 1000000)
{
// Restart the file with some of the end
char pch[200000];
fseek(file, -sizeof(pch), SEEK_END);
int nBytes = fread(pch, 1, sizeof(pch), file);
fclose(file);
if (file = fopen(strFile.c_str(), "w"))
{
fwrite(pch, 1, nBytes, file);
fclose(file);
}
}
}

2
util.h
View File

@ -111,6 +111,7 @@ extern bool fDebug;
extern bool fPrintToDebugger;
extern bool fPrintToConsole;
extern char pszSetDataDir[MAX_PATH];
extern bool fShutdown;
void RandAddSeed();
void RandAddSeedPerfmon();
@ -128,6 +129,7 @@ void ParseParameters(int argc, char* argv[]);
int GetFilesize(FILE* file);
void GetDataDir(char* pszDirRet);
string GetDataDir();
void ShrinkDebugFile();
uint64 GetRand(uint64 nMax);
int64 GetTime();
int64 GetAdjustedTime();