mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-22 16:14:50 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5681bb121 | ||
|
|
bed005b639 | ||
|
|
f93d5f9ffe | ||
|
|
2ca1758832 | ||
|
|
1da44d2e96 | ||
|
|
42605ce8bc | ||
|
|
124baa4ccb | ||
|
|
2d98de1b3a | ||
|
|
966cca4bd4 | ||
|
|
2cffa7ce31 | ||
|
|
d7d80a74d5 | ||
|
|
6557910ccf | ||
|
|
c2430126d7 |
209
build-osx.txt
Normal file
209
build-osx.txt
Normal file
@@ -0,0 +1,209 @@
|
||||
Mac OS X build instructions
|
||||
Laszlo Hanyecz (solar@heliacal.net)
|
||||
|
||||
|
||||
Tested on 10.5 and 10.6 intel. PPC is not supported because it's big-endian.
|
||||
|
||||
All of the commands should be executed in Terminal.app.. it's in
|
||||
/Applications/Utilities
|
||||
|
||||
You need to install XCode with all the options checked so that the compiler
|
||||
and everything is available in /usr not just /Developer
|
||||
I think it comes on the DVD but you can get the current version from
|
||||
http://developer.apple.com
|
||||
|
||||
|
||||
1. Pick a directory to work inside.. something like ~/bitcoin works. The
|
||||
structure I use looks like this:
|
||||
(~ is your home directory)
|
||||
|
||||
~/bitcoin
|
||||
~/bitcoin/trunk # source code
|
||||
~/bitcoin/deps # dependencies.. like libraries and headers needed to compile
|
||||
~/bitcoin/Bitcoin.app # the application bundle where you can run the app
|
||||
|
||||
Just execute: mkdir ~/bitcoin
|
||||
This will create the top dir for you..
|
||||
|
||||
WARNING: do not use the ~ notation with the configure scripts.. use the full
|
||||
name of the directory, for example /Users/james/bitcoin/deps for a user named
|
||||
'james'. In my examples I am using 'macosuser' so make sure you change that.
|
||||
|
||||
2. Check out the trunk version of the bitcoin code from subversion:
|
||||
|
||||
cd ~/bitcoin
|
||||
svn checkout https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk
|
||||
|
||||
This will make ~/bitcoin/trunk for you with all the files from subversion.
|
||||
|
||||
3. Get and build the dependencies
|
||||
|
||||
|
||||
Boost
|
||||
-----
|
||||
|
||||
Download from http://www.boost.org/users/download/
|
||||
I'm assuming it ended up in ~/Downloads..
|
||||
|
||||
mkdir ~/bitcoin/deps
|
||||
cd ~/bitcoin/deps
|
||||
tar xvjf ~/Downloads/boost_1_42_0.tar.bz2
|
||||
cd boost_1_42_0
|
||||
./bootstrap.sh
|
||||
./bjam architecture=combined address-model=32_64 macosx-version=10.6 macosx-version-min=10.5 link=static runtime-link=static --toolset=darwin --prefix=/Users/macosuser/bitcoin/deps install
|
||||
|
||||
This part takes a while.. use your judgement and fix it if something doesn't
|
||||
build for some reason.
|
||||
|
||||
Change the prefix to whatever your directory is (my username in this example
|
||||
is macosuser). I'm also running on 10.6 so i have macosx-version=10.6 change
|
||||
to 10.5 if you're using leopard.
|
||||
|
||||
This is what my output looked like at the end:
|
||||
...failed updating 2 targets...
|
||||
...skipped 144 targets...
|
||||
...updated 8074 targets...
|
||||
|
||||
|
||||
OpenSSL
|
||||
-------
|
||||
|
||||
Download from http://www.openssl.org/source/
|
||||
|
||||
We would like to build this as a 32 bit/64 bit library so we actually build it
|
||||
2 times and join it together here.. If you downloaded with safari it already
|
||||
uncompressed it so it will just be a tar not a tar.gz
|
||||
|
||||
cd ~/bitcoin/deps
|
||||
tar xvf ~/Downloads/openssl-1.0.0.tar
|
||||
mv openssl-1.0.0 openssl-1.0.0-i386
|
||||
tar xvf ~/Downloads/openssl-1.0.0.tar
|
||||
mv openssl-1.0.0 openssl-1.0.0-x86_64
|
||||
# build i386 (32 bit intel) binary
|
||||
cd openssl-1.0.0-i386
|
||||
./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/deps/openssl darwin-i386-cc && make
|
||||
make install # only do this on one of the architectures, to install the headers
|
||||
cd ..
|
||||
# build x86_64 (64 bit intel) binary
|
||||
cd openssl-1.0.0-x86_64
|
||||
./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/deps/openssl darwin64-x86_64-cc && make
|
||||
cd ..
|
||||
|
||||
# combine the libs
|
||||
cd ~/bitcoin/deps
|
||||
lipo -arch i386 openssl-1.0.0-i386/libcrypto.a -arch x86_64 openssl-1.0.0-x86_64/libcrypto.a -o lib/libcrypto.a -create
|
||||
lipo -arch i386 openssl-1.0.0-i386/libssl.a -arch x86_64 openssl-1.0.0-x86_64/libssl.a -o lib/libssl.a -create
|
||||
|
||||
Verify your binaries
|
||||
|
||||
file lib/libcrypto.a
|
||||
|
||||
output should look like this:
|
||||
|
||||
ib/libcrypto.a: Mach-O universal binary with 2 architectures
|
||||
lib/libcrypto.a (for architecture i386): current ar archive random library
|
||||
lib/libcrypto.a (for architecture x86_64): current ar archive random library
|
||||
|
||||
|
||||
Berkeley DB
|
||||
-----------
|
||||
|
||||
Download from http://freshmeat.net/projects/berkeleydb/
|
||||
|
||||
cd ~/bitcoin/deps
|
||||
tar xvf ~/Downloads/db-4.8.26.tar
|
||||
cd db-4.8.26/build_unix
|
||||
../dist/configure --prefix=/Users/macosuser/bitcoin/deps --enable-cxx && make && make install
|
||||
|
||||
|
||||
wxWidgets
|
||||
---------
|
||||
|
||||
This is the big one..
|
||||
|
||||
Check it out from svn
|
||||
|
||||
cd ~/bitcoin/deps
|
||||
svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk
|
||||
|
||||
This will make a wxWidgets-trunk directory in deps.
|
||||
|
||||
Use this script snippet, change your prefix to whatever your dir is:
|
||||
|
||||
PREFIX=~/bitcoin/deps
|
||||
SRCDIR="$PREFIX/wxWidgets-trunk"
|
||||
BUILDDIR="$SRCDIR/macbuild"
|
||||
|
||||
cd "$PREFIX" &&
|
||||
#svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk &&
|
||||
cd "$SRCDIR" &&
|
||||
|
||||
[ -f include/wx/hashmap.h.orig ] || cp include/wx/hashmap.h include/wx/hashmap.h.orig &&
|
||||
sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashmap.h.orig > include/wx/hashmap.h &&
|
||||
|
||||
[ -f include/wx/hashset.h.orig ] || cp include/wx/hashset.h include/wx/hashset.h.orig &&
|
||||
sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashset.h.orig > include/wx/hashset.h &&
|
||||
|
||||
|
||||
|
||||
rm -vrf "$BUILDDIR" &&
|
||||
mkdir "$BUILDDIR" &&
|
||||
cd "$BUILDDIR" &&
|
||||
|
||||
../configure --prefix="$PREFIX" \
|
||||
--with-osx_cocoa \
|
||||
--disable-shared \
|
||||
--disable-debug_flag \
|
||||
--with-macosx-version-min=10.5 \
|
||||
--enable-stl \
|
||||
--enable-utf8 \
|
||||
--enable-universal_binary \
|
||||
--with-libjpeg=builtin \
|
||||
--with-libpng=builtin \
|
||||
--with-regex=builtin \
|
||||
--with-libtiff=builtin \
|
||||
--with-zlib=builtin \
|
||||
--with-expat=builtin \
|
||||
--with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk &&
|
||||
|
||||
|
||||
find . -name Makefile |
|
||||
while read i; do
|
||||
echo $i;
|
||||
sed 's/-arch i386/-arch i386 -arch x86_64/g' < "$i" > "$i".new &&
|
||||
mv "$i" "$i".old &&
|
||||
mv "$i".new "$i";
|
||||
done
|
||||
|
||||
|
||||
|
||||
make &&
|
||||
make install
|
||||
|
||||
|
||||
|
||||
Now you should be able to build bitcoin
|
||||
|
||||
cd ~/bitcoin/trunk
|
||||
make -f makefile.osx bitcoin
|
||||
|
||||
Before you can run it, you need to create an application bundle for Mac OS.
|
||||
Create the directories in terminal using mkdir and copy the files into place.
|
||||
They are available at http://heliacal.net/~solar/bitcoin/mac-build/
|
||||
You need the Info.plist and the .ins file. The Contents/MacOS/bitcoin file is
|
||||
the output of the build.
|
||||
Your directory structure should look like this:
|
||||
|
||||
Bitcoin.app
|
||||
Bitcoin.app/Contents
|
||||
Bitcoin.app/Contents/Info.plist
|
||||
Bitcoin.app/Contents/MacOS
|
||||
Bitcoin.app/Contents/MacOS/bitcoin
|
||||
Bitcoin.app/Contents/Resources
|
||||
Bitcoin.app/Contents/Resources/BitcoinAppIcon.icns
|
||||
|
||||
To run it you can just click the Bitcoin.app in Finder, or just do open
|
||||
~/bitcoin/Bitcoin.app
|
||||
If you want to run it with arguments you can just run it without backgrounding
|
||||
by specifying the full name in terminal:
|
||||
~/bitcoin/Bitcoin.app/Contents/MacOS/bitcoin -addnode=192.75.207.66
|
||||
9
db.cpp
9
db.cpp
@@ -511,9 +511,9 @@ bool LoadAddresses()
|
||||
// CWalletDB
|
||||
//
|
||||
|
||||
bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet)
|
||||
bool CWalletDB::LoadWallet()
|
||||
{
|
||||
vchDefaultKeyRet.clear();
|
||||
vchDefaultKey.clear();
|
||||
int nFileVersion = 0;
|
||||
|
||||
// Modify defaults
|
||||
@@ -587,7 +587,7 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet)
|
||||
}
|
||||
else if (strType == "defaultkey")
|
||||
{
|
||||
ssValue >> vchDefaultKeyRet;
|
||||
ssValue >> vchDefaultKey;
|
||||
}
|
||||
else if (strType == "version")
|
||||
{
|
||||
@@ -650,8 +650,7 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet)
|
||||
bool LoadWallet(bool& fFirstRunRet)
|
||||
{
|
||||
fFirstRunRet = false;
|
||||
vector<unsigned char> vchDefaultKey;
|
||||
if (!CWalletDB("cr+").LoadWallet(vchDefaultKey))
|
||||
if (!CWalletDB("cr+").LoadWallet())
|
||||
return false;
|
||||
fFirstRunRet = vchDefaultKey.empty();
|
||||
|
||||
|
||||
7
db.h
7
db.h
@@ -14,9 +14,11 @@ class CWalletTx;
|
||||
|
||||
extern map<string, string> mapAddressBook;
|
||||
extern CCriticalSection cs_mapAddressBook;
|
||||
extern vector<unsigned char> vchDefaultKey;
|
||||
extern bool fClient;
|
||||
|
||||
|
||||
|
||||
extern unsigned int nWalletDBUpdated;
|
||||
extern DbEnv dbenv;
|
||||
|
||||
@@ -328,6 +330,8 @@ public:
|
||||
|
||||
bool EraseName(const string& strAddress)
|
||||
{
|
||||
// This should only be used for sending addresses, never for receiving addresses,
|
||||
// receiving addresses must always have an address book entry if they're not change return.
|
||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||
mapAddressBook.erase(strAddress);
|
||||
nWalletDBUpdated++;
|
||||
@@ -371,6 +375,7 @@ public:
|
||||
|
||||
bool WriteDefaultKey(const vector<unsigned char>& vchPubKey)
|
||||
{
|
||||
vchDefaultKey = vchPubKey;
|
||||
nWalletDBUpdated++;
|
||||
return Write(string("defaultkey"), vchPubKey);
|
||||
}
|
||||
@@ -388,7 +393,7 @@ public:
|
||||
return Write(make_pair(string("setting"), strKey), value);
|
||||
}
|
||||
|
||||
bool LoadWallet(vector<unsigned char>& vchDefaultKeyRet);
|
||||
bool LoadWallet();
|
||||
};
|
||||
|
||||
bool LoadWallet(bool& fFirstRunRet);
|
||||
|
||||
11
headers.h
11
headers.h
@@ -19,11 +19,13 @@
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#define __STDC_LIMIT_MACROS // to enable UINT64_MAX from stdint.h
|
||||
#include <wx/wx.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/snglinst.h>
|
||||
#include <wx/taskbar.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/snglinst.h>
|
||||
#if wxUSE_GUI
|
||||
#include <wx/utils.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/taskbar.h>
|
||||
#endif
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/rand.h>
|
||||
@@ -100,8 +102,11 @@ using namespace boost;
|
||||
#include "irc.h"
|
||||
#include "main.h"
|
||||
#include "rpc.h"
|
||||
#if wxUSE_GUI
|
||||
#include "uibase.h"
|
||||
#endif
|
||||
#include "ui.h"
|
||||
#include "init.h"
|
||||
|
||||
#include "xpm/addressbook16.xpm"
|
||||
#include "xpm/addressbook20.xpm"
|
||||
|
||||
635
init.cpp
Normal file
635
init.cpp
Normal file
@@ -0,0 +1,635 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "headers.h"
|
||||
|
||||
|
||||
|
||||
|
||||
void ExitTimeout(void* parg)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
Sleep(5000);
|
||||
ExitProcess(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Shutdown(void* parg)
|
||||
{
|
||||
static CCriticalSection cs_Shutdown;
|
||||
static bool fTaken;
|
||||
bool fFirstThread;
|
||||
CRITICAL_BLOCK(cs_Shutdown)
|
||||
{
|
||||
fFirstThread = !fTaken;
|
||||
fTaken = true;
|
||||
}
|
||||
static bool fExit;
|
||||
if (fFirstThread)
|
||||
{
|
||||
fShutdown = true;
|
||||
nTransactionsUpdated++;
|
||||
DBFlush(false);
|
||||
StopNode();
|
||||
DBFlush(true);
|
||||
CreateThread(ExitTimeout, NULL);
|
||||
Sleep(50);
|
||||
printf("Bitcoin exiting\n\n");
|
||||
fExit = true;
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (!fExit)
|
||||
Sleep(500);
|
||||
Sleep(100);
|
||||
ExitThread(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Startup folder
|
||||
//
|
||||
|
||||
#ifdef __WXMSW__
|
||||
typedef WINSHELLAPI BOOL (WINAPI *PSHGETSPECIALFOLDERPATHA)(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
|
||||
|
||||
string MyGetSpecialFolderPath(int nFolder, bool fCreate)
|
||||
{
|
||||
char pszPath[MAX_PATH+100] = "";
|
||||
|
||||
// SHGetSpecialFolderPath is not usually available on NT 4.0
|
||||
HMODULE hShell32 = LoadLibraryA("shell32.dll");
|
||||
if (hShell32)
|
||||
{
|
||||
PSHGETSPECIALFOLDERPATHA pSHGetSpecialFolderPath =
|
||||
(PSHGETSPECIALFOLDERPATHA)GetProcAddress(hShell32, "SHGetSpecialFolderPathA");
|
||||
if (pSHGetSpecialFolderPath)
|
||||
(*pSHGetSpecialFolderPath)(NULL, pszPath, nFolder, fCreate);
|
||||
FreeModule(hShell32);
|
||||
}
|
||||
|
||||
// Backup option
|
||||
if (pszPath[0] == '\0')
|
||||
{
|
||||
if (nFolder == CSIDL_STARTUP)
|
||||
{
|
||||
strcpy(pszPath, getenv("USERPROFILE"));
|
||||
strcat(pszPath, "\\Start Menu\\Programs\\Startup");
|
||||
}
|
||||
else if (nFolder == CSIDL_APPDATA)
|
||||
{
|
||||
strcpy(pszPath, getenv("APPDATA"));
|
||||
}
|
||||
}
|
||||
|
||||
return pszPath;
|
||||
}
|
||||
|
||||
string StartupShortcutPath()
|
||||
{
|
||||
return MyGetSpecialFolderPath(CSIDL_STARTUP, true) + "\\Bitcoin.lnk";
|
||||
}
|
||||
|
||||
bool GetStartOnSystemStartup()
|
||||
{
|
||||
return wxFileExists(StartupShortcutPath());
|
||||
}
|
||||
|
||||
void SetStartOnSystemStartup(bool fAutoStart)
|
||||
{
|
||||
// If the shortcut exists already, remove it for updating
|
||||
remove(StartupShortcutPath().c_str());
|
||||
|
||||
if (fAutoStart)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
// Get a pointer to the IShellLink interface.
|
||||
IShellLink* psl = NULL;
|
||||
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL,
|
||||
CLSCTX_INPROC_SERVER, IID_IShellLink,
|
||||
reinterpret_cast<void**>(&psl));
|
||||
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
// Get the current executable path
|
||||
TCHAR pszExePath[MAX_PATH];
|
||||
GetModuleFileName(NULL, pszExePath, sizeof(pszExePath));
|
||||
|
||||
// Set the path to the shortcut target
|
||||
psl->SetPath(pszExePath);
|
||||
PathRemoveFileSpec(pszExePath);
|
||||
psl->SetWorkingDirectory(pszExePath);
|
||||
psl->SetShowCmd(SW_SHOWMINNOACTIVE);
|
||||
|
||||
// Query IShellLink for the IPersistFile interface for
|
||||
// saving the shortcut in persistent storage.
|
||||
IPersistFile* ppf = NULL;
|
||||
hres = psl->QueryInterface(IID_IPersistFile,
|
||||
reinterpret_cast<void**>(&ppf));
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
WCHAR pwsz[MAX_PATH];
|
||||
// Ensure that the string is ANSI.
|
||||
MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().c_str(), -1, pwsz, MAX_PATH);
|
||||
// Save the link by calling IPersistFile::Save.
|
||||
hres = ppf->Save(pwsz, TRUE);
|
||||
ppf->Release();
|
||||
}
|
||||
psl->Release();
|
||||
}
|
||||
CoUninitialize();
|
||||
}
|
||||
}
|
||||
#else
|
||||
bool GetStartOnSystemStartup() { return false; }
|
||||
void SetStartOnSystemStartup(bool fAutoStart) { }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMyApp
|
||||
//
|
||||
|
||||
// Define a new application
|
||||
class CMyApp: public wxApp
|
||||
{
|
||||
public:
|
||||
wxLocale m_locale;
|
||||
|
||||
CMyApp(){};
|
||||
~CMyApp(){};
|
||||
bool OnInit();
|
||||
bool OnInit2();
|
||||
int OnExit();
|
||||
|
||||
// Hook Initialize so we can start without GUI
|
||||
virtual bool Initialize(int& argc, wxChar** argv);
|
||||
|
||||
// 2nd-level exception handling: we get all the exceptions occurring in any
|
||||
// event handler here
|
||||
virtual bool OnExceptionInMainLoop();
|
||||
|
||||
// 3rd, and final, level exception handling: whenever an unhandled
|
||||
// exception is caught, this function is called
|
||||
virtual void OnUnhandledException();
|
||||
|
||||
// and now for something different: this function is called in case of a
|
||||
// crash (e.g. dereferencing null pointer, division by 0, ...)
|
||||
virtual void OnFatalException();
|
||||
};
|
||||
|
||||
IMPLEMENT_APP(CMyApp)
|
||||
|
||||
bool CMyApp::Initialize(int& argc, wxChar** argv)
|
||||
{
|
||||
if (argc > 1 && argv[1][0] != '-' && (!fWindows || argv[1][0] != '/') &&
|
||||
wxString(argv[1]) != "start")
|
||||
{
|
||||
fCommandLine = true;
|
||||
}
|
||||
else if (!fGUI)
|
||||
{
|
||||
fDaemon = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// wxApp::Initialize will remove environment-specific parameters,
|
||||
// so it's too early to call ParseParameters yet
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
wxString str = argv[i];
|
||||
#ifdef __WXMSW__
|
||||
if (str.size() >= 1 && str[0] == '/')
|
||||
str[0] = '-';
|
||||
str = str.MakeLower();
|
||||
#endif
|
||||
// haven't decided which argument to use for this yet
|
||||
if (str == "-daemon" || str == "-d" || str == "start")
|
||||
fDaemon = true;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __WXGTK__
|
||||
if (fDaemon || fCommandLine)
|
||||
{
|
||||
// Call the original Initialize while suppressing error messages
|
||||
// and ignoring failure. If unable to initialize GTK, it fails
|
||||
// near the end so hopefully the last few things don't matter.
|
||||
{
|
||||
wxLogNull logNo;
|
||||
wxApp::Initialize(argc, argv);
|
||||
}
|
||||
|
||||
if (fDaemon)
|
||||
{
|
||||
// Daemonize
|
||||
pid_t pid = fork();
|
||||
if (pid < 0)
|
||||
{
|
||||
fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
|
||||
return false;
|
||||
}
|
||||
if (pid > 0)
|
||||
pthread_exit((void*)0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return wxApp::Initialize(argc, argv);
|
||||
}
|
||||
|
||||
bool CMyApp::OnInit()
|
||||
{
|
||||
bool fRet = false;
|
||||
try
|
||||
{
|
||||
fRet = OnInit2();
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
PrintException(&e, "OnInit()");
|
||||
} catch (...) {
|
||||
PrintException(NULL, "OnInit()");
|
||||
}
|
||||
if (!fRet)
|
||||
Shutdown(NULL);
|
||||
return fRet;
|
||||
}
|
||||
|
||||
extern int g_isPainting;
|
||||
|
||||
bool CMyApp::OnInit2()
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
// Turn off microsoft heap dump noise
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_WARN, CreateFileA("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0));
|
||||
#endif
|
||||
#if _MSC_VER >= 1400
|
||||
// Disable confusing "helpful" text message on abort, ctrl-c
|
||||
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
||||
#endif
|
||||
#if defined(__WXMSW__) && defined(__WXDEBUG__) && wxUSE_GUI
|
||||
// Disable malfunctioning wxWidgets debug assertion
|
||||
g_isPainting = 10000;
|
||||
#endif
|
||||
#if wxUSE_GUI
|
||||
wxImage::AddHandler(new wxPNGHandler);
|
||||
#endif
|
||||
#if defined(__WXMSW__ ) || defined(__WXMAC__)
|
||||
SetAppName("Bitcoin");
|
||||
#else
|
||||
SetAppName("bitcoin");
|
||||
#endif
|
||||
#ifndef __WXMSW__
|
||||
umask(077);
|
||||
#endif
|
||||
#ifdef __WXMSW__
|
||||
#if wxUSE_UNICODE
|
||||
// Hack to set wxConvLibc codepage to UTF-8 on Windows,
|
||||
// may break if wxMBConv_win32 implementation in strconv.cpp changes.
|
||||
class wxMBConv_win32 : public wxMBConv
|
||||
{
|
||||
public:
|
||||
long m_CodePage;
|
||||
size_t m_minMBCharWidth;
|
||||
};
|
||||
if (((wxMBConv_win32*)&wxConvLibc)->m_CodePage == CP_ACP)
|
||||
((wxMBConv_win32*)&wxConvLibc)->m_CodePage = CP_UTF8;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Load locale/<lang>/LC_MESSAGES/bitcoin.mo language file
|
||||
m_locale.Init(wxLANGUAGE_DEFAULT, 0);
|
||||
m_locale.AddCatalogLookupPathPrefix("locale");
|
||||
if (!fWindows)
|
||||
{
|
||||
m_locale.AddCatalogLookupPathPrefix("/usr/share/locale");
|
||||
m_locale.AddCatalogLookupPathPrefix("/usr/local/share/locale");
|
||||
}
|
||||
m_locale.AddCatalog("wxstd"); // wxWidgets standard translations, if any
|
||||
m_locale.AddCatalog("bitcoin");
|
||||
|
||||
//
|
||||
// Parameters
|
||||
//
|
||||
if (fCommandLine)
|
||||
{
|
||||
int ret = CommandLineRPC(argc, argv);
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
ParseParameters(argc, argv);
|
||||
if (mapArgs.count("-?") || mapArgs.count("--help"))
|
||||
{
|
||||
wxString strUsage = string() +
|
||||
_("Usage:") + "\t\t\t\t\t\t\t\t\t\t\n" +
|
||||
" bitcoin [options] \t" + "\n" +
|
||||
" bitcoin [command] \t" + _("Send command to bitcoin running with -server or -daemon\n") +
|
||||
" bitcoin [command] -? \t" + _("Get help for a command\n") +
|
||||
" bitcoin help \t" + _("List commands\n") +
|
||||
_("Options:\n") +
|
||||
" -gen \t " + _("Generate coins\n") +
|
||||
" -gen=0 \t " + _("Don't generate coins\n") +
|
||||
" -min \t " + _("Start minimized\n") +
|
||||
" -datadir=<dir> \t " + _("Specify data directory\n") +
|
||||
" -proxy=<ip:port>\t " + _("Connect through socks4 proxy\n") +
|
||||
" -addnode=<ip> \t " + _("Add a node to connect to\n") +
|
||||
" -connect=<ip> \t " + _("Connect only to the specified node\n") +
|
||||
" -server \t " + _("Accept command line and JSON-RPC commands\n") +
|
||||
" -daemon \t " + _("Run in the background as a daemon and accept commands\n") +
|
||||
" -? \t " + _("This help message\n");
|
||||
|
||||
|
||||
if (fWindows && fGUI)
|
||||
{
|
||||
// Tabs make the columns line up in the message box
|
||||
wxMessageBox(strUsage, "Bitcoin", wxOK);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove tabs
|
||||
strUsage.Replace("\t", "");
|
||||
fprintf(stderr, "%s", ((string)strUsage).c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mapArgs.count("-datadir"))
|
||||
strlcpy(pszSetDataDir, mapArgs["-datadir"].c_str(), sizeof(pszSetDataDir));
|
||||
|
||||
if (mapArgs.count("-debug"))
|
||||
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 0.%d.%d%s beta, OS version %s\n", VERSION/100, VERSION%100, pszSubVer, ((string)wxGetOsDescription()).c_str());
|
||||
printf("System default language is %d %s\n", m_locale.GetSystemLanguage(), ((string)m_locale.GetSysName()).c_str());
|
||||
printf("Language file %s (%s)\n", (string("locale/") + (string)m_locale.GetCanonicalName() + "/LC_MESSAGES/bitcoin.mo").c_str(), ((string)m_locale.GetLocale()).c_str());
|
||||
|
||||
if (mapArgs.count("-loadblockindextest"))
|
||||
{
|
||||
CTxDB txdb("r");
|
||||
txdb.LoadBlockIndex();
|
||||
PrintBlockTree();
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Limit to single instance per user
|
||||
// Required to protect the database files if we're going to keep deleting log.*
|
||||
//
|
||||
#ifdef __WXMSW__
|
||||
// todo: wxSingleInstanceChecker wasn't working on Linux, never deleted its lock file
|
||||
// maybe should go by whether successfully bind port 8333 instead
|
||||
wxString strMutexName = wxString("bitcoin_running.") + getenv("HOMEPATH");
|
||||
for (int i = 0; i < strMutexName.size(); i++)
|
||||
if (!isalnum(strMutexName[i]))
|
||||
strMutexName[i] = '.';
|
||||
wxSingleInstanceChecker* psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
|
||||
if (psingleinstancechecker->IsAnotherRunning())
|
||||
{
|
||||
printf("Existing instance found\n");
|
||||
unsigned int nStart = GetTime();
|
||||
loop
|
||||
{
|
||||
// TODO: find out how to do this in Linux, or replace with wxWidgets commands
|
||||
// Show the previous instance and exit
|
||||
HWND hwndPrev = FindWindowA("wxWindowClassNR", "Bitcoin");
|
||||
if (hwndPrev)
|
||||
{
|
||||
if (IsIconic(hwndPrev))
|
||||
ShowWindow(hwndPrev, SW_RESTORE);
|
||||
SetForegroundWindow(hwndPrev);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetTime() > nStart + 60)
|
||||
return false;
|
||||
|
||||
// Resume this instance if the other exits
|
||||
delete psingleinstancechecker;
|
||||
Sleep(1000);
|
||||
psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
|
||||
if (!psingleinstancechecker->IsAnotherRunning())
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Bind to the port early so we can tell if another instance is already running.
|
||||
// This is a backup to wxSingleInstanceChecker, which doesn't work on Linux.
|
||||
string strErrors;
|
||||
if (!BindListenPort(strErrors))
|
||||
{
|
||||
wxMessageBox(strErrors, "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Load data files
|
||||
//
|
||||
if (fDaemon)
|
||||
fprintf(stdout, "bitcoin server starting\n");
|
||||
strErrors = "";
|
||||
int64 nStart;
|
||||
|
||||
printf("Loading addresses...\n");
|
||||
nStart = GetTimeMillis();
|
||||
if (!LoadAddresses())
|
||||
strErrors += _("Error loading addr.dat \n");
|
||||
printf(" addresses %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
|
||||
printf("Loading block index...\n");
|
||||
nStart = GetTimeMillis();
|
||||
if (!LoadBlockIndex())
|
||||
strErrors += _("Error loading blkindex.dat \n");
|
||||
printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
|
||||
printf("Loading wallet...\n");
|
||||
nStart = GetTimeMillis();
|
||||
bool fFirstRun;
|
||||
if (!LoadWallet(fFirstRun))
|
||||
strErrors += _("Error loading wallet.dat \n");
|
||||
printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
|
||||
printf("Done loading\n");
|
||||
|
||||
//// debug print
|
||||
printf("mapBlockIndex.size() = %d\n", mapBlockIndex.size());
|
||||
printf("nBestHeight = %d\n", nBestHeight);
|
||||
printf("mapKeys.size() = %d\n", mapKeys.size());
|
||||
printf("mapPubKeys.size() = %d\n", mapPubKeys.size());
|
||||
printf("mapWallet.size() = %d\n", mapWallet.size());
|
||||
printf("mapAddressBook.size() = %d\n", mapAddressBook.size());
|
||||
|
||||
if (!strErrors.empty())
|
||||
{
|
||||
wxMessageBox(strErrors, "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add wallet transactions that aren't already in a block to mapTransactions
|
||||
ReacceptWalletTransactions();
|
||||
|
||||
//
|
||||
// Parameters
|
||||
//
|
||||
if (mapArgs.count("-printblockindex") || mapArgs.count("-printblocktree"))
|
||||
{
|
||||
PrintBlockTree();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mapArgs.count("-printblock"))
|
||||
{
|
||||
string strMatch = mapArgs["-printblock"];
|
||||
int nFound = 0;
|
||||
for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
|
||||
{
|
||||
uint256 hash = (*mi).first;
|
||||
if (strncmp(hash.ToString().c_str(), strMatch.c_str(), strMatch.size()) == 0)
|
||||
{
|
||||
CBlockIndex* pindex = (*mi).second;
|
||||
CBlock block;
|
||||
block.ReadFromDisk(pindex);
|
||||
block.BuildMerkleTree();
|
||||
block.print();
|
||||
printf("\n");
|
||||
nFound++;
|
||||
}
|
||||
}
|
||||
if (nFound == 0)
|
||||
printf("No blocks matching %s were found\n", strMatch.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mapArgs.count("-gen"))
|
||||
{
|
||||
if (mapArgs["-gen"].empty())
|
||||
fGenerateBitcoins = true;
|
||||
else
|
||||
fGenerateBitcoins = (atoi(mapArgs["-gen"].c_str()) != 0);
|
||||
}
|
||||
|
||||
if (mapArgs.count("-proxy"))
|
||||
{
|
||||
fUseProxy = true;
|
||||
addrProxy = CAddress(mapArgs["-proxy"]);
|
||||
if (!addrProxy.IsValid())
|
||||
{
|
||||
wxMessageBox(_("Invalid -proxy address"), "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mapArgs.count("-addnode"))
|
||||
{
|
||||
foreach(string strAddr, mapMultiArgs["-addnode"])
|
||||
{
|
||||
CAddress addr(strAddr, NODE_NETWORK);
|
||||
addr.nTime = 0; // so it won't relay unless successfully connected
|
||||
if (addr.IsValid())
|
||||
AddAddress(addr);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Create the main window and start the node
|
||||
//
|
||||
if (!fDaemon)
|
||||
CreateMainWindow();
|
||||
|
||||
if (!CheckDiskSpace())
|
||||
return false;
|
||||
|
||||
RandAddSeedPerfmon();
|
||||
|
||||
if (!CreateThread(StartNode, NULL))
|
||||
wxMessageBox("Error: CreateThread(StartNode) failed", "Bitcoin");
|
||||
|
||||
if (mapArgs.count("-server") || fDaemon)
|
||||
CreateThread(ThreadRPCServer, NULL);
|
||||
|
||||
if (fFirstRun)
|
||||
SetStartOnSystemStartup(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int CMyApp::OnExit()
|
||||
{
|
||||
Shutdown(NULL);
|
||||
return wxApp::OnExit();
|
||||
}
|
||||
|
||||
bool CMyApp::OnExceptionInMainLoop()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
PrintException(&e, "CMyApp::OnExceptionInMainLoop()");
|
||||
wxLogWarning("Exception %s %s", typeid(e).name(), e.what());
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PrintException(NULL, "CMyApp::OnExceptionInMainLoop()");
|
||||
wxLogWarning("Unknown exception");
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CMyApp::OnUnhandledException()
|
||||
{
|
||||
// this shows how we may let some exception propagate uncaught
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
PrintException(&e, "CMyApp::OnUnhandledException()");
|
||||
wxLogWarning("Exception %s %s", typeid(e).name(), e.what());
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PrintException(NULL, "CMyApp::OnUnhandledException()");
|
||||
wxLogWarning("Unknown exception");
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void CMyApp::OnFatalException()
|
||||
{
|
||||
wxMessageBox(_("Program has crashed and will terminate. "), "Bitcoin", wxOK | wxICON_ERROR);
|
||||
}
|
||||
7
init.h
Normal file
7
init.h
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
void Shutdown(void* parg);
|
||||
bool GetStartOnSystemStartup();
|
||||
void SetStartOnSystemStartup(bool fAutoStart);
|
||||
6
irc.cpp
6
irc.cpp
@@ -76,6 +76,8 @@ bool RecvLine(SOCKET hSocket, string& strLine)
|
||||
if (c == '\r')
|
||||
return true;
|
||||
strLine += c;
|
||||
if (strLine.size() >= 9000)
|
||||
return true;
|
||||
}
|
||||
else if (nBytes <= 0)
|
||||
{
|
||||
@@ -109,7 +111,7 @@ bool RecvLineIRC(SOCKET hSocket, string& strLine)
|
||||
return false;
|
||||
vector<string> vWords;
|
||||
ParseString(strLine, ' ', vWords);
|
||||
if (vWords[0] == "PING")
|
||||
if (vWords.size() >= 1 && vWords[0] == "PING")
|
||||
{
|
||||
strLine[1] = 'O';
|
||||
strLine += '\r';
|
||||
@@ -156,7 +158,7 @@ bool Wait(int nSeconds)
|
||||
|
||||
void ThreadIRCSeed(void* parg)
|
||||
{
|
||||
SetThreadPriority(THREAD_PRIORITY_NORMAL);
|
||||
printf("ThreadIRCSeed started\n");
|
||||
int nErrorWait = 10;
|
||||
int nRetryWait = 10;
|
||||
bool fNameInUse = false;
|
||||
|
||||
BIN
locale/it/LC_MESSAGES/bitcoin.mo
Normal file
BIN
locale/it/LC_MESSAGES/bitcoin.mo
Normal file
Binary file not shown.
806
locale/it/LC_MESSAGES/bitcoin.po
Normal file
806
locale/it/LC_MESSAGES/bitcoin.po
Normal file
@@ -0,0 +1,806 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2010-05-26 22:02-0000\n"
|
||||
"PO-Revision-Date: 2010-05-27 13:01+0100\n"
|
||||
"Last-Translator: Franco Cimatti <hostfat@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"X-Poedit-SearchPath-0: ../../..\n"
|
||||
|
||||
#: ../../../init.cpp:342
|
||||
msgid "Usage: bitcoin [options]"
|
||||
msgstr "Uso: bitcoin [options]"
|
||||
|
||||
#: ../../../init.cpp:343
|
||||
msgid "Options:\n"
|
||||
msgstr "Opzioni:\n"
|
||||
|
||||
#: ../../../init.cpp:344
|
||||
msgid "Generate coins\n"
|
||||
msgstr "Genera monete\n"
|
||||
|
||||
#: ../../../init.cpp:345
|
||||
msgid "Don't generate coins\n"
|
||||
msgstr "Non generare monete\n"
|
||||
|
||||
#: ../../../init.cpp:346
|
||||
msgid "Start minimized\n"
|
||||
msgstr "Avvia minimizzato\n"
|
||||
|
||||
#: ../../../init.cpp:347
|
||||
msgid "Specify data directory\n"
|
||||
msgstr "Indica la cartella per i dati\n"
|
||||
|
||||
#: ../../../init.cpp:348
|
||||
msgid "Connect through socks4 proxy\n"
|
||||
msgstr "Connetti attraverso proxy socks4\n"
|
||||
|
||||
#: ../../../init.cpp:349
|
||||
msgid "Add a node to connect to\n"
|
||||
msgstr "Aggiungi un nodo a cui connetterti\n"
|
||||
|
||||
#: ../../../init.cpp:350
|
||||
msgid "Connect only to the specified node\n"
|
||||
msgstr "Impossibile connettersi al nodo specificato\n"
|
||||
|
||||
#: ../../../init.cpp:351
|
||||
msgid "This help message\n"
|
||||
msgstr "Questo messaggio di aiuto\n"
|
||||
|
||||
#: ../../../init.cpp:455
|
||||
msgid "Error loading addr.dat \n"
|
||||
msgstr "Errore nel caricare addr.dat \n"
|
||||
|
||||
#: ../../../init.cpp:461
|
||||
msgid "Error loading blkindex.dat \n"
|
||||
msgstr "Errore nel caricare blkindex.dat \n"
|
||||
|
||||
#: ../../../init.cpp:468
|
||||
msgid "Error loading wallet.dat \n"
|
||||
msgstr "Errore nel caricare wallet.dat \n"
|
||||
|
||||
#: ../../../init.cpp:536
|
||||
msgid "Invalid -proxy address"
|
||||
msgstr "Indirizzo proxy non valido"
|
||||
|
||||
#: ../../../init.cpp:629
|
||||
msgid "Program has crashed and will terminate. "
|
||||
msgstr "Il programma è crashato e sarà terminato. "
|
||||
|
||||
#: ../../../main.cpp:1465
|
||||
msgid "Warning: Disk space is low "
|
||||
msgstr "Attenzione: c'è poco spazio sul disco "
|
||||
|
||||
#: ../../../main.cpp:2994
|
||||
#, c-format
|
||||
msgid "Error: This is an oversized transaction that requires a transaction fee of %s "
|
||||
msgstr "Errore: Questa è un operazione fuoriscala che richiede un sovrapprezzo di %s "
|
||||
|
||||
#: ../../../main.cpp:2996
|
||||
msgid "Error: Transaction creation failed "
|
||||
msgstr "Errore: La creazione del trasferimento è fallito "
|
||||
|
||||
#: ../../../main.cpp:3001
|
||||
#: ../../../ui.cpp:1761
|
||||
#: ../../../ui.cpp:1763
|
||||
#: ../../../ui.cpp:1904
|
||||
#: ../../../ui.cpp:2053
|
||||
msgid "Sending..."
|
||||
msgstr "Inviando..."
|
||||
|
||||
#: ../../../main.cpp:3005
|
||||
msgid "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."
|
||||
msgstr "Errore: Il trasferimento è stato respinto. Questo può accadere se alcune delle monete nel tuo portafoglio erano già state spese, o anche se hai usato una copia di wallet.dat e le monete erano già state spese nella copia originale ma non segnate in quest'ultima."
|
||||
|
||||
#: ../../../main.cpp:3017
|
||||
msgid "Invalid amount"
|
||||
msgstr "Quantità non valida"
|
||||
|
||||
#: ../../../main.cpp:3019
|
||||
#: ../../../ui.cpp:1971
|
||||
#: ../../../ui.cpp:2038
|
||||
msgid "Insufficient funds"
|
||||
msgstr "Fondi insufficenti"
|
||||
|
||||
#: ../../../main.cpp:3024
|
||||
msgid "Invalid bitcoin address"
|
||||
msgstr "Indirizzo bitcoin non valido"
|
||||
|
||||
#: ../../../ui.cpp:189
|
||||
#, c-format
|
||||
msgid "This transaction is over the size limit. You can still send it for a fee of %s, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?"
|
||||
msgstr "Questo trasferimento è oltre le dimensioni massime. Puoi comunque inviarlo per un costo aggiuntivo di %s, che andrà ai nodi che effettueranno il processo della tua operazione e che supportano il network. Vuoi pagare il costo aggiuntivo?"
|
||||
|
||||
#: ../../../ui.cpp:285
|
||||
msgid "Status"
|
||||
msgstr "Stato"
|
||||
|
||||
#: ../../../ui.cpp:286
|
||||
msgid "Date"
|
||||
msgstr "Data"
|
||||
|
||||
#: ../../../ui.cpp:287
|
||||
msgid "Description"
|
||||
msgstr "Descrizione"
|
||||
|
||||
#: ../../../ui.cpp:288
|
||||
msgid "Debit"
|
||||
msgstr "Debito"
|
||||
|
||||
#: ../../../ui.cpp:289
|
||||
msgid "Credit"
|
||||
msgstr "Credito"
|
||||
|
||||
#: ../../../ui.cpp:489
|
||||
#, c-format
|
||||
msgid "Open for %d blocks"
|
||||
msgstr "Aperto per %d blocchi"
|
||||
|
||||
#: ../../../ui.cpp:491
|
||||
#, c-format
|
||||
msgid "Open until %s"
|
||||
msgstr "Aperto fino a %s"
|
||||
|
||||
#: ../../../ui.cpp:497
|
||||
#, c-format
|
||||
msgid "%d/offline?"
|
||||
msgstr "%d/fuorilinea?"
|
||||
|
||||
#: ../../../ui.cpp:499
|
||||
#, c-format
|
||||
msgid "%d/unconfirmed"
|
||||
msgstr "%d/non confermato"
|
||||
|
||||
#: ../../../ui.cpp:501
|
||||
#, c-format
|
||||
msgid "%d confirmations"
|
||||
msgstr "%d conferme"
|
||||
|
||||
#: ../../../ui.cpp:584
|
||||
msgid "Generated"
|
||||
msgstr "Generato"
|
||||
|
||||
#: ../../../ui.cpp:592
|
||||
#, c-format
|
||||
msgid "Generated (%s matures in %d more blocks)"
|
||||
msgstr "Generate (%s matureranno in %d altri blocchi)"
|
||||
|
||||
#: ../../../ui.cpp:596
|
||||
msgid "Generated - Warning: This block was not received by any other nodes and will probably not be accepted!"
|
||||
msgstr "Generato - Attenzione: Questo blocco non è stato ricevuto da nessun altro nodo e probabilmente non sarà accettato!"
|
||||
|
||||
#: ../../../ui.cpp:600
|
||||
msgid "Generated (not accepted)"
|
||||
msgstr "Generato (non accettato)"
|
||||
|
||||
#: ../../../ui.cpp:610
|
||||
msgid "From: "
|
||||
msgstr "Da: "
|
||||
|
||||
#: ../../../ui.cpp:634
|
||||
msgid "From: unknown, Received with: "
|
||||
msgstr "Da: sconosciuto, Ricevuto con: "
|
||||
|
||||
#: ../../../ui.cpp:676
|
||||
msgid "Payment to yourself"
|
||||
msgstr "Pagamento a te stesso"
|
||||
|
||||
#: ../../../ui.cpp:713
|
||||
msgid "To: "
|
||||
msgstr "A: "
|
||||
|
||||
#: ../../../ui.cpp:1009
|
||||
msgid " Generating"
|
||||
msgstr " Generando"
|
||||
|
||||
#: ../../../ui.cpp:1011
|
||||
msgid "(not connected)"
|
||||
msgstr "(non connesso)"
|
||||
|
||||
#: ../../../ui.cpp:1014
|
||||
#, c-format
|
||||
msgid " %d connections %d blocks %d transactions"
|
||||
msgstr " %d connessioni %d blocchi %d trasferimenti"
|
||||
|
||||
#: ../../../ui.cpp:1123
|
||||
#: ../../../ui.cpp:2351
|
||||
msgid "New Receiving Address"
|
||||
msgstr "Nuovo indirizzo ricevente"
|
||||
|
||||
#: ../../../ui.cpp:1124
|
||||
#: ../../../ui.cpp:2352
|
||||
msgid ""
|
||||
"It's good policy to use a new address for each payment you receive.\n"
|
||||
"\n"
|
||||
"Label"
|
||||
msgstr ""
|
||||
"E' una buona abitudine usare un nuovo indirizzo per ogni pagamento che ricevuto.\n"
|
||||
"\n"
|
||||
"Label"
|
||||
|
||||
#: ../../../ui.cpp:1193
|
||||
msgid "<b>Status:</b> "
|
||||
msgstr "<b>Stato:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1198
|
||||
msgid ", has not been successfully broadcast yet"
|
||||
msgstr ", non è ancora stato diffuso correttamente"
|
||||
|
||||
#: ../../../ui.cpp:1200
|
||||
#, c-format
|
||||
msgid ", broadcast through %d node"
|
||||
msgstr ", diffusione attraverso %d nodo"
|
||||
|
||||
#: ../../../ui.cpp:1202
|
||||
#, c-format
|
||||
msgid ", broadcast through %d nodes"
|
||||
msgstr ", diffusione attraverso %d nodi"
|
||||
|
||||
#: ../../../ui.cpp:1206
|
||||
msgid "<b>Date:</b> "
|
||||
msgstr "<b>Data:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1214
|
||||
msgid "<b>Source:</b> Generated<br>"
|
||||
msgstr "<b>Sorgente:</b> Generato<br>"
|
||||
|
||||
#: ../../../ui.cpp:1220
|
||||
#: ../../../ui.cpp:1238
|
||||
msgid "<b>From:</b> "
|
||||
msgstr "<b>Da:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1238
|
||||
msgid "unknown"
|
||||
msgstr "sconoscuto"
|
||||
|
||||
#: ../../../ui.cpp:1239
|
||||
#: ../../../ui.cpp:1263
|
||||
#: ../../../ui.cpp:1322
|
||||
msgid "<b>To:</b> "
|
||||
msgstr "<b>A:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1242
|
||||
msgid " (yours, label: "
|
||||
msgstr " (vostro, label: "
|
||||
|
||||
#: ../../../ui.cpp:1244
|
||||
msgid " (yours)"
|
||||
msgstr " (vostro)"
|
||||
|
||||
#: ../../../ui.cpp:1281
|
||||
#: ../../../ui.cpp:1293
|
||||
#: ../../../ui.cpp:1356
|
||||
msgid "<b>Credit:</b> "
|
||||
msgstr "<b>Credito:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1283
|
||||
#, c-format
|
||||
msgid "(%s matures in %d more blocks)"
|
||||
msgstr "(%s matureranno in %d altri blocchi)"
|
||||
|
||||
#: ../../../ui.cpp:1285
|
||||
msgid "(not accepted)"
|
||||
msgstr "(non accettato)"
|
||||
|
||||
#: ../../../ui.cpp:1330
|
||||
#: ../../../ui.cpp:1353
|
||||
msgid "<b>Debit:</b> "
|
||||
msgstr "<b>Debito:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1344
|
||||
msgid "<b>Transaction fee:</b> "
|
||||
msgstr "<b>Trasferimento costo:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1360
|
||||
msgid "<b>Net amount:</b> "
|
||||
msgstr "<b>Quantità del network:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1367
|
||||
msgid "Message:"
|
||||
msgstr "Messaggio:"
|
||||
|
||||
#: ../../../ui.cpp:1370
|
||||
msgid "Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours."
|
||||
msgstr "Le monete generate devono aspettare 120 blocchi prima di poter essere spese. Quando hai generato questo blocco, è stato diffuso sul network per essere aggiunto alla catena dei blocchi. Se fallirà l'entrata nella catena, cambierà in \"non accettato\" e non spendibile. Questo può capitare se un altro nodo genera un blocco pochi secondi prima del tuo."
|
||||
|
||||
#: ../../../ui.cpp:1437
|
||||
msgid "Main"
|
||||
msgstr "Principale"
|
||||
|
||||
#: ../../../ui.cpp:1442
|
||||
msgid "&Minimize on close"
|
||||
msgstr "&Minimizza se chiuso"
|
||||
|
||||
#: ../../../ui.cpp:1595
|
||||
#, c-format
|
||||
msgid "version 0.%d.%d beta"
|
||||
msgstr "versione 0.%d.%d beta"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
msgstr "Apparirà come \"Da: Sconosciuto\""
|
||||
|
||||
#: ../../../ui.cpp:1682
|
||||
msgid "Can't include a message when sending to a Bitcoin address"
|
||||
msgstr "Non si può includere un messaggio quando si invia attraverso l'indirizzo Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:1735
|
||||
msgid "Error in amount "
|
||||
msgstr "Errore nell'ammontare "
|
||||
|
||||
#: ../../../ui.cpp:1735
|
||||
#: ../../../ui.cpp:1740
|
||||
#: ../../../ui.cpp:1745
|
||||
#: ../../../ui.cpp:1771
|
||||
#: ../../../uibase.cpp:61
|
||||
msgid "Send Coins"
|
||||
msgstr "Invia monete"
|
||||
|
||||
#: ../../../ui.cpp:1740
|
||||
msgid "Amount exceeds your balance "
|
||||
msgstr "L'ammontare è andato oltre i tuoi capitali "
|
||||
|
||||
#: ../../../ui.cpp:1745
|
||||
msgid "Total exceeds your balance when the "
|
||||
msgstr "Il totale va oltre i tuoi capitali quando il "
|
||||
|
||||
#: ../../../ui.cpp:1745
|
||||
msgid " transaction fee is included "
|
||||
msgstr " il costo trasferimento è incluso "
|
||||
|
||||
#: ../../../ui.cpp:1761
|
||||
msgid "Payment sent "
|
||||
msgstr "Pagamento inviato "
|
||||
|
||||
#: ../../../ui.cpp:1771
|
||||
msgid "Invalid address "
|
||||
msgstr "Indirizzo non valido "
|
||||
|
||||
#: ../../../ui.cpp:1825
|
||||
#, c-format
|
||||
msgid "Sending %s to %s"
|
||||
msgstr "Inviando %s a %s"
|
||||
|
||||
#: ../../../ui.cpp:1898
|
||||
#: ../../../ui.cpp:1931
|
||||
msgid "CANCELLED"
|
||||
msgstr "CANCELLATO"
|
||||
|
||||
#: ../../../ui.cpp:1902
|
||||
msgid "Cancelled"
|
||||
msgstr "Cancellato"
|
||||
|
||||
#: ../../../ui.cpp:1904
|
||||
msgid "Transfer cancelled "
|
||||
msgstr "Operazione cancellata "
|
||||
|
||||
#: ../../../ui.cpp:1957
|
||||
msgid "Error: "
|
||||
msgstr "Errore: "
|
||||
|
||||
#: ../../../ui.cpp:1976
|
||||
msgid "Connecting..."
|
||||
msgstr "Connessione in corso..."
|
||||
|
||||
#: ../../../ui.cpp:1981
|
||||
msgid "Unable to connect"
|
||||
msgstr "Impossibile connettersi"
|
||||
|
||||
#: ../../../ui.cpp:1986
|
||||
msgid "Requesting public key..."
|
||||
msgstr "Richiesta chiave pubblica..."
|
||||
|
||||
#: ../../../ui.cpp:1998
|
||||
msgid "Received public key..."
|
||||
msgstr "Ricezione chiave pubblica..."
|
||||
|
||||
#: ../../../ui.cpp:2010
|
||||
msgid "Transfer was not accepted"
|
||||
msgstr "Trasferimento non accettato"
|
||||
|
||||
#: ../../../ui.cpp:2019
|
||||
msgid "Invalid response received"
|
||||
msgstr "Risposta non valida ricevuta"
|
||||
|
||||
#: ../../../ui.cpp:2034
|
||||
msgid "Creating transaction..."
|
||||
msgstr "Creazione trasferimento..."
|
||||
|
||||
#: ../../../ui.cpp:2046
|
||||
#, c-format
|
||||
msgid "This is an oversized transaction that requires a transaction fee of %s"
|
||||
msgstr "Questo è un trasferimento fuoriscala che richiede un costo aggiuntivo di %s"
|
||||
|
||||
#: ../../../ui.cpp:2048
|
||||
msgid "Transaction creation failed"
|
||||
msgstr "Creazione trasferimento fallita"
|
||||
|
||||
#: ../../../ui.cpp:2055
|
||||
msgid "Transaction aborted"
|
||||
msgstr "Trasferimento bloccato"
|
||||
|
||||
#: ../../../ui.cpp:2063
|
||||
msgid "Lost connection, transaction cancelled"
|
||||
msgstr "Connessione persa, trasferimento cancellato"
|
||||
|
||||
#: ../../../ui.cpp:2079
|
||||
msgid "Sending payment..."
|
||||
msgstr "Inviando pagamento..."
|
||||
|
||||
#: ../../../ui.cpp:2085
|
||||
msgid "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."
|
||||
msgstr "Il trasferimento è stato respinto. Questo può accadere se alcune delle monete nel tuo portafoglio erano già state spese, o anche se hai usato una copia di wallet.dat e le monete erano già state spese nella copia originale ma non segnate in quest'ultima."
|
||||
|
||||
#: ../../../ui.cpp:2092
|
||||
msgid "Waiting for confirmation..."
|
||||
msgstr "In attesa di conferma..."
|
||||
|
||||
#: ../../../ui.cpp:2110
|
||||
msgid ""
|
||||
"The payment was sent, but the recipient was unable to verify it.\n"
|
||||
"The transaction is recorded and will credit to the recipient,\n"
|
||||
"but the comment information will be blank."
|
||||
msgstr ""
|
||||
"Il pagamento è inviato, ma il ricevente non è stato in grado di verificarlo.\n"
|
||||
"Il trasferimento è registrato e costerà sarà accreditato al ricevente,\n"
|
||||
"ma il commento verrà mostrato come vuoto."
|
||||
|
||||
#: ../../../ui.cpp:2119
|
||||
msgid "Payment was sent, but an invalid response was received"
|
||||
msgstr "Il pagamento è stato inviato, ma è arrivata un risposta invalida"
|
||||
|
||||
#: ../../../ui.cpp:2125
|
||||
msgid "Payment completed"
|
||||
msgstr "Pagamento completato"
|
||||
|
||||
#: ../../../ui.cpp:2156
|
||||
#: ../../../ui.cpp:2302
|
||||
#: ../../../ui.cpp:2339
|
||||
msgid "Name"
|
||||
msgstr "Nome"
|
||||
|
||||
#: ../../../ui.cpp:2157
|
||||
#: ../../../ui.cpp:2302
|
||||
#: ../../../ui.cpp:2339
|
||||
msgid "Address"
|
||||
msgstr "Indirizzo"
|
||||
|
||||
#: ../../../ui.cpp:2159
|
||||
#: ../../../ui.cpp:2314
|
||||
msgid "Label"
|
||||
msgstr "Label"
|
||||
|
||||
#: ../../../ui.cpp:2160
|
||||
#: ../../../uibase.cpp:908
|
||||
msgid "Bitcoin Address"
|
||||
msgstr "Indirizzo Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:2284
|
||||
msgid "This is one of your own addresses for receiving payments and cannot be entered in the address book. "
|
||||
msgstr "Questo qui è uno dei tuoi indirizzi personali per ricevere pagamenti e non può essere inserito nella rubrica indirizzi. "
|
||||
|
||||
#: ../../../ui.cpp:2302
|
||||
#: ../../../ui.cpp:2308
|
||||
msgid "Edit Address"
|
||||
msgstr "Modifica indirizzo"
|
||||
|
||||
#: ../../../ui.cpp:2314
|
||||
msgid "Edit Address Label"
|
||||
msgstr "Modifica spazio indirizzo"
|
||||
|
||||
#: ../../../ui.cpp:2339
|
||||
#: ../../../ui.cpp:2345
|
||||
msgid "Add Address"
|
||||
msgstr "Aggiungi indirizzo"
|
||||
|
||||
#: ../../../ui.cpp:2421
|
||||
msgid "Bitcoin"
|
||||
msgstr "Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:2423
|
||||
msgid "Bitcoin - Generating"
|
||||
msgstr "Bitcoin - Generando"
|
||||
|
||||
#: ../../../ui.cpp:2425
|
||||
msgid "Bitcoin - (not connected)"
|
||||
msgstr "Bitcoin - (non connesso)"
|
||||
|
||||
#: ../../../ui.cpp:2500
|
||||
msgid "&Open Bitcoin"
|
||||
msgstr "&Apri Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:2501
|
||||
msgid "O&ptions..."
|
||||
msgstr "O&pzioni..."
|
||||
|
||||
#: ../../../ui.cpp:2502
|
||||
#: ../../../uibase.cpp:34
|
||||
msgid "&Generate Coins"
|
||||
msgstr "&Genera monete"
|
||||
|
||||
#: ../../../ui.cpp:2505
|
||||
#: ../../../uibase.cpp:27
|
||||
msgid "E&xit"
|
||||
msgstr "E&sci"
|
||||
|
||||
#: ../../../uibase.cpp:30
|
||||
msgid "&File"
|
||||
msgstr "&File"
|
||||
|
||||
#: ../../../uibase.cpp:38
|
||||
msgid "&Your Receiving Addresses..."
|
||||
msgstr "&Il tuo indirizzo di ricezione..."
|
||||
|
||||
#: ../../../uibase.cpp:42
|
||||
msgid "&Options..."
|
||||
msgstr "&Opzioni..."
|
||||
|
||||
#: ../../../uibase.cpp:45
|
||||
msgid "&Settings"
|
||||
msgstr "I&mpostazioni"
|
||||
|
||||
#: ../../../uibase.cpp:49
|
||||
msgid "&About..."
|
||||
msgstr "&Info..."
|
||||
|
||||
#: ../../../uibase.cpp:52
|
||||
msgid "&Help"
|
||||
msgstr "&Aiuto"
|
||||
|
||||
#: ../../../uibase.cpp:62
|
||||
msgid "Address Book"
|
||||
msgstr "Rubrica indirizzi"
|
||||
|
||||
#: ../../../uibase.cpp:77
|
||||
msgid "Your Bitcoin Address:"
|
||||
msgstr "Il tuo indirizzo Bitcoin:"
|
||||
|
||||
#: ../../../uibase.cpp:84
|
||||
msgid " &New... "
|
||||
msgstr " &Nuovo... "
|
||||
|
||||
#: ../../../uibase.cpp:87
|
||||
#: ../../../uibase.cpp:851
|
||||
#: ../../../uibase.cpp:954
|
||||
msgid " &Copy to Clipboard "
|
||||
msgstr " &Copia nella Clipboard "
|
||||
|
||||
#: ../../../uibase.cpp:102
|
||||
msgid "Balance:"
|
||||
msgstr "Capitali:"
|
||||
|
||||
#: ../../../uibase.cpp:121
|
||||
msgid " All"
|
||||
msgstr " Tutte"
|
||||
|
||||
#: ../../../uibase.cpp:121
|
||||
msgid " Sent"
|
||||
msgstr " Inviato"
|
||||
|
||||
#: ../../../uibase.cpp:121
|
||||
msgid " Received"
|
||||
msgstr " Ricevuto"
|
||||
|
||||
#: ../../../uibase.cpp:121
|
||||
msgid " In Progress"
|
||||
msgstr " In lavorazione"
|
||||
|
||||
#: ../../../uibase.cpp:142
|
||||
msgid "All Transactions"
|
||||
msgstr "Tutte le operazioni"
|
||||
|
||||
#: ../../../uibase.cpp:153
|
||||
msgid "Sent/Received"
|
||||
msgstr "Inviato/Ricevuto"
|
||||
|
||||
#: ../../../uibase.cpp:164
|
||||
msgid "Sent"
|
||||
msgstr "Inviato"
|
||||
|
||||
#: ../../../uibase.cpp:175
|
||||
msgid "Received"
|
||||
msgstr "Ricevuto"
|
||||
|
||||
#: ../../../uibase.cpp:318
|
||||
#: ../../../uibase.cpp:479
|
||||
#: ../../../uibase.cpp:580
|
||||
#: ../../../uibase.cpp:793
|
||||
#: ../../../uibase.cpp:854
|
||||
#: ../../../uibase.cpp:963
|
||||
#: ../../../uibase.cpp:1052
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: ../../../uibase.cpp:361
|
||||
msgid "Optional transaction fee you give to the nodes that process your transactions."
|
||||
msgstr "Costo aggiuntivo opzionale che tu dai ai nodi che realizzano i tuoi trasferimenti"
|
||||
|
||||
#: ../../../uibase.cpp:370
|
||||
msgid "Transaction fee:"
|
||||
msgstr "Costo trasferimento:"
|
||||
|
||||
#: ../../../uibase.cpp:386
|
||||
msgid "&Limit coin generation to"
|
||||
msgstr "&Limita la generazione moneta a"
|
||||
|
||||
#: ../../../uibase.cpp:393
|
||||
msgid "processors"
|
||||
msgstr "processori"
|
||||
|
||||
#: ../../../uibase.cpp:399
|
||||
msgid "&Start Bitcoin on system startup"
|
||||
msgstr "A&vvia Bitcoin all'avvio del sistema"
|
||||
|
||||
#: ../../../uibase.cpp:403
|
||||
msgid "&Minimize to the tray instead of the taskbar"
|
||||
msgstr "&Minimizza nella tray invece che nella barra"
|
||||
|
||||
#: ../../../uibase.cpp:407
|
||||
msgid "M&inimize to the tray on close"
|
||||
msgstr "M&inimizza nella tray alla chiusura"
|
||||
|
||||
#: ../../../uibase.cpp:414
|
||||
msgid "&Connect through socks4 proxy: "
|
||||
msgstr "%Connesso attraverso proxy socks4: "
|
||||
|
||||
#: ../../../uibase.cpp:426
|
||||
msgid "Proxy &IP:"
|
||||
msgstr "Proxy &IP:"
|
||||
|
||||
#: ../../../uibase.cpp:434
|
||||
msgid " &Port:"
|
||||
msgstr " &Porta:"
|
||||
|
||||
#: ../../../uibase.cpp:456
|
||||
msgid "// [don't translate] Test panel 2 for future expansion"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../uibase.cpp:460
|
||||
msgid "// [don't translate] Let's not start multiple pages until the first page is filled up"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../uibase.cpp:482
|
||||
#: ../../../uibase.cpp:735
|
||||
#: ../../../uibase.cpp:798
|
||||
#: ../../../uibase.cpp:857
|
||||
#: ../../../uibase.cpp:966
|
||||
#: ../../../uibase.cpp:1055
|
||||
msgid "Cancel"
|
||||
msgstr "Cancella"
|
||||
|
||||
#: ../../../uibase.cpp:485
|
||||
msgid "&Apply"
|
||||
msgstr "&Accetta"
|
||||
|
||||
#: ../../../uibase.cpp:546
|
||||
msgid "Bitcoin "
|
||||
msgstr "Bitcoin "
|
||||
|
||||
#: ../../../uibase.cpp:552
|
||||
msgid "version"
|
||||
msgstr "versione"
|
||||
|
||||
#: ../../../uibase.cpp:563
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"\n"
|
||||
"This is experimental software. Do not rely on it for actual financial transactions.\n"
|
||||
"\n"
|
||||
"Distributed under the MIT/X11 software license, see the accompanying file \n"
|
||||
"license.txt or http://www.opensource.org/licenses/mit-license.php.\n"
|
||||
"\n"
|
||||
"This product includes software developed by the OpenSSL Project for use in the \n"
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"\n"
|
||||
"Questo è un software sperimentale. Non affidartici per gli attuali trasferimenti finanziari.\n"
|
||||
"\n"
|
||||
"Distribuito sotto la licenza software MIT/X11, guarda il file license.txt incluso oppure su http://www.opensource.org/licenses/mit-license.php.\n"
|
||||
"\n"
|
||||
"Questo prodoto include software sviluppato dal progetto OpenSSL per l'uso del \n"
|
||||
"(http://www.openssl.org/) e il software criptografico scritto da \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
|
||||
#: ../../../uibase.cpp:619
|
||||
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"
|
||||
msgstr "Inserisci un indirizzo Bitcoin (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) o un indirizzo IP (e.g. 123.45.6.7)"
|
||||
|
||||
#: ../../../uibase.cpp:633
|
||||
msgid "Pay &To:"
|
||||
msgstr "Paga %a:"
|
||||
|
||||
#: ../../../uibase.cpp:648
|
||||
msgid "&Paste"
|
||||
msgstr "&Incolla"
|
||||
|
||||
#: ../../../uibase.cpp:651
|
||||
msgid " Address &Book..."
|
||||
msgstr " &Rubrica degli indirizzi..."
|
||||
|
||||
#: ../../../uibase.cpp:658
|
||||
msgid "&Amount:"
|
||||
msgstr "&Quantità"
|
||||
|
||||
#: ../../../uibase.cpp:668
|
||||
msgid "T&ransfer:"
|
||||
msgstr "T&rasferimento:"
|
||||
|
||||
#: ../../../uibase.cpp:674
|
||||
msgid " Standard"
|
||||
msgstr " Standard"
|
||||
|
||||
#: ../../../uibase.cpp:696
|
||||
msgid "&From:"
|
||||
msgstr "&Proveniente da:"
|
||||
|
||||
#: ../../../uibase.cpp:713
|
||||
msgid "&Message:"
|
||||
msgstr "&Messaggio:"
|
||||
|
||||
#: ../../../uibase.cpp:730
|
||||
msgid "&Send"
|
||||
msgstr "&Invia"
|
||||
|
||||
#: ../../../uibase.cpp:782
|
||||
msgid ""
|
||||
"\n"
|
||||
"\n"
|
||||
"Connecting..."
|
||||
msgstr ""
|
||||
"\n"
|
||||
"\n"
|
||||
"Connessione in corso..."
|
||||
|
||||
#: ../../../uibase.cpp:832
|
||||
msgid "These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you. The highlighted address is displayed in the main window."
|
||||
msgstr "Questi sono i tuoi indirizzi Bitcoin per ricevere pagamenti. Potrai darne uno diverso ad ognuno per cosi tenere traccia di chi ti sta pagando. L'indirizzo selezionato sarà quello mostrato nella finestra principale."
|
||||
|
||||
#: ../../../uibase.cpp:845
|
||||
#: ../../../uibase.cpp:957
|
||||
msgid "&Edit..."
|
||||
msgstr "&Cambia..."
|
||||
|
||||
#: ../../../uibase.cpp:848
|
||||
#: ../../../uibase.cpp:960
|
||||
msgid " &New Address... "
|
||||
msgstr " &Nuovo indirizzo... "
|
||||
|
||||
#: ../../../uibase.cpp:920
|
||||
msgid "Sending"
|
||||
msgstr "Inviando"
|
||||
|
||||
#: ../../../uibase.cpp:928
|
||||
msgid "These are your Bitcoin addresses for receiving payments. You can give a different one to each sender to keep track of who is paying you. The highlighted address will be displayed in the main window."
|
||||
msgstr "Questi sono i tuoi indirizzi Bitcoin per ricevere pagamenti. Potrai darne uno diverso ad ognuno per cosi tenere traccia di chi ti sta pagando. L'indirizzo selezionato sarà quello mostrato nella finestra principale."
|
||||
|
||||
#: ../../../uibase.cpp:941
|
||||
msgid "Receiving"
|
||||
msgstr "Ricevendo"
|
||||
|
||||
#: ../../../uibase.cpp:951
|
||||
msgid "&Delete"
|
||||
msgstr "&Cancella"
|
||||
|
||||
#: ../../../uibase.h:150
|
||||
msgid "Transaction Details"
|
||||
msgstr "Dettagli operazione"
|
||||
|
||||
#: ../../../uibase.h:203
|
||||
msgid "Options"
|
||||
msgstr "Opzioni"
|
||||
|
||||
#: ../../../uibase.h:231
|
||||
msgid "About Bitcoin"
|
||||
msgstr "Info Bitcoin"
|
||||
|
||||
#: ../../../uibase.h:341
|
||||
msgid "Your Bitcoin Addresses"
|
||||
msgstr "Il tuo indirizzo Bitcoin"
|
||||
BIN
locale/nl/LC_MESSAGES/bitcoin.mo
Normal file
BIN
locale/nl/LC_MESSAGES/bitcoin.mo
Normal file
Binary file not shown.
808
locale/nl/LC_MESSAGES/bitcoin.po
Normal file
808
locale/nl/LC_MESSAGES/bitcoin.po
Normal file
@@ -0,0 +1,808 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2010-05-26 22:02-0000\n"
|
||||
"PO-Revision-Date: 2010-05-27 19:27+0100\n"
|
||||
"Last-Translator: Xunie\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"X-Poedit-SearchPath-0: ../../..\n"
|
||||
|
||||
#: ../../../init.cpp:342
|
||||
msgid "Usage: bitcoin [options]"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../init.cpp:343
|
||||
msgid "Options:\n"
|
||||
msgstr "Opties:\n"
|
||||
|
||||
#: ../../../init.cpp:344
|
||||
msgid "Generate coins\n"
|
||||
msgstr "Genereer coins\n"
|
||||
|
||||
#: ../../../init.cpp:345
|
||||
msgid "Don't generate coins\n"
|
||||
msgstr "Genereer geen coins\n"
|
||||
|
||||
#: ../../../init.cpp:346
|
||||
msgid "Start minimized\n"
|
||||
msgstr "Start geminimalizeerd\n"
|
||||
|
||||
#: ../../../init.cpp:347
|
||||
msgid "Specify data directory\n"
|
||||
msgstr "Specificeer data map\n"
|
||||
|
||||
#: ../../../init.cpp:348
|
||||
msgid "Connect through socks4 proxy\n"
|
||||
msgstr "Verbind via socks4 proxy\n"
|
||||
|
||||
#: ../../../init.cpp:349
|
||||
msgid "Add a node to connect to\n"
|
||||
msgstr "Voeg een node om naar te verbinden toe\n"
|
||||
|
||||
#: ../../../init.cpp:350
|
||||
msgid "Connect only to the specified node\n"
|
||||
msgstr "Verbind alleen naar deze node\n"
|
||||
|
||||
#: ../../../init.cpp:351
|
||||
msgid "This help message\n"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../init.cpp:455
|
||||
msgid "Error loading addr.dat \n"
|
||||
msgstr "Fout bij laden van bestand addr.dat \n"
|
||||
|
||||
#: ../../../init.cpp:461
|
||||
msgid "Error loading blkindex.dat \n"
|
||||
msgstr "Fout bij laden van bestand blkindex.dat \n"
|
||||
|
||||
#: ../../../init.cpp:468
|
||||
msgid "Error loading wallet.dat \n"
|
||||
msgstr "Fout bij laden van bestand wallet.dat \n"
|
||||
|
||||
#: ../../../init.cpp:536
|
||||
msgid "Invalid -proxy address"
|
||||
msgstr "Foutief -proxy adres"
|
||||
|
||||
#: ../../../init.cpp:629
|
||||
msgid "Program has crashed and will terminate. "
|
||||
msgstr "Programma is gecrashed en word afgesloten. "
|
||||
|
||||
#: ../../../main.cpp:1465
|
||||
msgid "Warning: Disk space is low "
|
||||
msgstr "Waarschuwng: Gebrek aan schijf ruimte "
|
||||
|
||||
#: ../../../main.cpp:2994
|
||||
#, c-format
|
||||
msgid "Error: This is an oversized transaction that requires a transaction fee of %s "
|
||||
msgstr "Fout: Dit is een te grote transactie die een fooi nodig heeft van %s "
|
||||
|
||||
#: ../../../main.cpp:2996
|
||||
msgid "Error: Transaction creation failed "
|
||||
msgstr "Fout: Transactie aanmaak gefaald "
|
||||
|
||||
#: ../../../main.cpp:3001
|
||||
#: ../../../ui.cpp:1761
|
||||
#: ../../../ui.cpp:1763
|
||||
#: ../../../ui.cpp:1904
|
||||
#: ../../../ui.cpp:2053
|
||||
msgid "Sending..."
|
||||
msgstr "Versturen..."
|
||||
|
||||
#: ../../../main.cpp:3005
|
||||
msgid "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."
|
||||
msgstr "Fout: De transactie was afgekeurd. Dit kan komen als bepaalde coins in uw Portefeuille al zijn uitgegeven. Dit kan komen doordat u wallet.dat heeft gekopieerd en wat coins heeft uitgegeven en niet terug gekopieerd heeft."
|
||||
|
||||
#: ../../../main.cpp:3017
|
||||
msgid "Invalid amount"
|
||||
msgstr "Foutief aantal"
|
||||
|
||||
#: ../../../main.cpp:3019
|
||||
#: ../../../ui.cpp:1971
|
||||
#: ../../../ui.cpp:2038
|
||||
msgid "Insufficient funds"
|
||||
msgstr "Onvoldoende coins"
|
||||
|
||||
#: ../../../main.cpp:3024
|
||||
msgid "Invalid bitcoin address"
|
||||
msgstr "Foutief bitcoin adres"
|
||||
|
||||
#: ../../../ui.cpp:189
|
||||
#, c-format
|
||||
msgid "This transaction is over the size limit. You can still send it for a fee of %s, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?"
|
||||
msgstr "Deze transactie is over het limiet. U kunt nog door gaan met de transactie door een fooi te betalen van %s, deze word betaald aan de node die uw tranactie verwerkt. Wilt u de fooi betalen?"
|
||||
|
||||
#: ../../../ui.cpp:285
|
||||
msgid "Status"
|
||||
msgstr "Status"
|
||||
|
||||
#: ../../../ui.cpp:286
|
||||
msgid "Date"
|
||||
msgstr "Datum"
|
||||
|
||||
#: ../../../ui.cpp:287
|
||||
msgid "Description"
|
||||
msgstr "Beschrijving"
|
||||
|
||||
#: ../../../ui.cpp:288
|
||||
msgid "Debit"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../ui.cpp:289
|
||||
msgid "Credit"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../ui.cpp:489
|
||||
#, c-format
|
||||
msgid "Open for %d blocks"
|
||||
msgstr "Open voor %d blocks"
|
||||
|
||||
#: ../../../ui.cpp:491
|
||||
#, c-format
|
||||
msgid "Open until %s"
|
||||
msgstr "Open tot %s"
|
||||
|
||||
#: ../../../ui.cpp:497
|
||||
#, c-format
|
||||
msgid "%d/offline?"
|
||||
msgstr "%d/offline?"
|
||||
|
||||
#: ../../../ui.cpp:499
|
||||
#, c-format
|
||||
msgid "%d/unconfirmed"
|
||||
msgstr "%d/niet bevestigd"
|
||||
|
||||
#: ../../../ui.cpp:501
|
||||
#, c-format
|
||||
msgid "%d confirmations"
|
||||
msgstr "%d bevestigingen"
|
||||
|
||||
#: ../../../ui.cpp:584
|
||||
msgid "Generated"
|
||||
msgstr "Gegenereerd"
|
||||
|
||||
#: ../../../ui.cpp:592
|
||||
#, c-format
|
||||
msgid "Generated (%s matures in %d more blocks)"
|
||||
msgstr "Gegenereerd (%s word volwassen in %d blokken)"
|
||||
|
||||
#: ../../../ui.cpp:596
|
||||
msgid "Generated - Warning: This block was not received by any other nodes and will probably not be accepted!"
|
||||
msgstr "Gegenereerd - Waarschuwing: Dit blok is niet ontvangen door andere nodes en zal waarschijnlijk niet geaccepteerd worden!"
|
||||
|
||||
#: ../../../ui.cpp:600
|
||||
msgid "Generated (not accepted)"
|
||||
msgstr "Gegenereerd (niet geaccepteerd)"
|
||||
|
||||
#: ../../../ui.cpp:610
|
||||
msgid "From: "
|
||||
msgstr "Van: "
|
||||
|
||||
#: ../../../ui.cpp:634
|
||||
msgid "From: unknown, Received with: "
|
||||
msgstr "Van: onbekend, Ontvangen met: "
|
||||
|
||||
#: ../../../ui.cpp:676
|
||||
msgid "Payment to yourself"
|
||||
msgstr "Betaling naar u zelf"
|
||||
|
||||
#: ../../../ui.cpp:713
|
||||
msgid "To: "
|
||||
msgstr "Naar: "
|
||||
|
||||
#: ../../../ui.cpp:1009
|
||||
msgid " Generating"
|
||||
msgstr " Genereert"
|
||||
|
||||
#: ../../../ui.cpp:1011
|
||||
msgid "(not connected)"
|
||||
msgstr "(niet verbonden)"
|
||||
|
||||
#: ../../../ui.cpp:1014
|
||||
#, c-format
|
||||
msgid " %d connections %d blocks %d transactions"
|
||||
msgstr " %d verbindingen %d blokken %d transacties"
|
||||
|
||||
#: ../../../ui.cpp:1123
|
||||
#: ../../../ui.cpp:2351
|
||||
msgid "New Receiving Address"
|
||||
msgstr "Nieuw Ontvangings Adres"
|
||||
|
||||
#: ../../../ui.cpp:1124
|
||||
#: ../../../ui.cpp:2352
|
||||
msgid ""
|
||||
"It's good policy to use a new address for each payment you receive.\n"
|
||||
"\n"
|
||||
"Label"
|
||||
msgstr ""
|
||||
"Het is goed beleid om een nieuw adres voor elke betaling te hebben.\n"
|
||||
"\n"
|
||||
"Label"
|
||||
|
||||
#: ../../../ui.cpp:1193
|
||||
msgid "<b>Status:</b> "
|
||||
msgstr "<b>Status:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1198
|
||||
msgid ", has not been successfully broadcast yet"
|
||||
msgstr ", is nog niet succesvol verstuurd naar het netwerk"
|
||||
|
||||
#: ../../../ui.cpp:1200
|
||||
#, c-format
|
||||
msgid ", broadcast through %d node"
|
||||
msgstr ", verstuurd via %d node"
|
||||
|
||||
#: ../../../ui.cpp:1202
|
||||
#, c-format
|
||||
msgid ", broadcast through %d nodes"
|
||||
msgstr ", verstuurd via %d nodes"
|
||||
|
||||
#: ../../../ui.cpp:1206
|
||||
msgid "<b>Date:</b> "
|
||||
msgstr "<b>Datum:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1214
|
||||
msgid "<b>Source:</b> Generated<br>"
|
||||
msgstr "<b>Bron:</b> Gegenereerd<br>"
|
||||
|
||||
#: ../../../ui.cpp:1220
|
||||
#: ../../../ui.cpp:1238
|
||||
msgid "<b>From:</b> "
|
||||
msgstr "<b>Van:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1238
|
||||
msgid "unknown"
|
||||
msgstr "onbekend"
|
||||
|
||||
#: ../../../ui.cpp:1239
|
||||
#: ../../../ui.cpp:1263
|
||||
#: ../../../ui.cpp:1322
|
||||
msgid "<b>To:</b> "
|
||||
msgstr "<b>Naar:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1242
|
||||
msgid " (yours, label: "
|
||||
msgstr ""
|
||||
|
||||
#: ../../../ui.cpp:1244
|
||||
#, fuzzy
|
||||
msgid " (yours)"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../ui.cpp:1281
|
||||
#: ../../../ui.cpp:1293
|
||||
#: ../../../ui.cpp:1356
|
||||
msgid "<b>Credit:</b> "
|
||||
msgstr ""
|
||||
|
||||
#: ../../../ui.cpp:1283
|
||||
#, c-format
|
||||
msgid "(%s matures in %d more blocks)"
|
||||
msgstr "(%s word volwassen in %d blokken)"
|
||||
|
||||
#: ../../../ui.cpp:1285
|
||||
msgid "(not accepted)"
|
||||
msgstr "(niet geaccepteerd"
|
||||
|
||||
#: ../../../ui.cpp:1330
|
||||
#: ../../../ui.cpp:1353
|
||||
msgid "<b>Debit:</b> "
|
||||
msgstr ""
|
||||
|
||||
#: ../../../ui.cpp:1344
|
||||
msgid "<b>Transaction fee:</b> "
|
||||
msgstr "<b>Transactie fooi:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1360
|
||||
msgid "<b>Net amount:</b> "
|
||||
msgstr "<b>Netto bedrag:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1367
|
||||
msgid "Message:"
|
||||
msgstr "Mededeling:"
|
||||
|
||||
#: ../../../ui.cpp:1370
|
||||
msgid "Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours."
|
||||
msgstr "Gegenereerde coins moeten 120 blokken wachten voordat ze uitgegeven kunnen worden. Wanneer je dit blok genereerde, werd het naar het netwerk gestuurd om opgenomen teworden in de rest van de blokken. Als dit faalt, dan zal de dit veranderen in \"niet geaccepteerd\" en zal niet uitgeefbaar zijn. Dit kan soms gebeuren als een node ook een blok rond dezelfde periode genereerd."
|
||||
|
||||
#: ../../../ui.cpp:1437
|
||||
msgid "Main"
|
||||
msgstr "Hoofd"
|
||||
|
||||
#: ../../../ui.cpp:1442
|
||||
msgid "&Minimize on close"
|
||||
msgstr "&Minimalizeer bij sluiten"
|
||||
|
||||
#: ../../../ui.cpp:1595
|
||||
#, c-format
|
||||
msgid "version 0.%d.%d beta"
|
||||
msgstr "versie 0.%d.%d beta"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
msgstr "Word vertoont als \"Van: Onbekend\""
|
||||
|
||||
#: ../../../ui.cpp:1682
|
||||
msgid "Can't include a message when sending to a Bitcoin address"
|
||||
msgstr "Kan geen mededeling versturen bij gebruik van Bitcoin adressen"
|
||||
|
||||
#: ../../../ui.cpp:1735
|
||||
msgid "Error in amount "
|
||||
msgstr "Fout in hoeveelheid "
|
||||
|
||||
#: ../../../ui.cpp:1735
|
||||
#: ../../../ui.cpp:1740
|
||||
#: ../../../ui.cpp:1745
|
||||
#: ../../../ui.cpp:1771
|
||||
#: ../../../uibase.cpp:61
|
||||
msgid "Send Coins"
|
||||
msgstr "Verstuur Coins"
|
||||
|
||||
#: ../../../ui.cpp:1740
|
||||
msgid "Amount exceeds your balance "
|
||||
msgstr "Hoeveelheid hoger dan uw huidige balans "
|
||||
|
||||
#: ../../../ui.cpp:1745
|
||||
msgid "Total exceeds your balance when the "
|
||||
msgstr "Totaal groter dan uw huidige balans wanner de "
|
||||
|
||||
#: ../../../ui.cpp:1745
|
||||
msgid " transaction fee is included "
|
||||
msgstr " transactie fooi is bijgerekend "
|
||||
|
||||
#: ../../../ui.cpp:1761
|
||||
msgid "Payment sent "
|
||||
msgstr "Betaling verstuurd "
|
||||
|
||||
#: ../../../ui.cpp:1771
|
||||
msgid "Invalid address "
|
||||
msgstr "Foutief adres "
|
||||
|
||||
#: ../../../ui.cpp:1825
|
||||
#, c-format
|
||||
msgid "Sending %s to %s"
|
||||
msgstr "Verstuurd %s naar %s"
|
||||
|
||||
#: ../../../ui.cpp:1898
|
||||
#: ../../../ui.cpp:1931
|
||||
msgid "CANCELLED"
|
||||
msgstr "GEANNULEERD"
|
||||
|
||||
#: ../../../ui.cpp:1902
|
||||
msgid "Cancelled"
|
||||
msgstr "Geannuleerd"
|
||||
|
||||
#: ../../../ui.cpp:1904
|
||||
msgid "Transfer cancelled "
|
||||
msgstr "Transactie geannuleerd "
|
||||
|
||||
#: ../../../ui.cpp:1957
|
||||
msgid "Error: "
|
||||
msgstr "Fout: "
|
||||
|
||||
#: ../../../ui.cpp:1976
|
||||
msgid "Connecting..."
|
||||
msgstr "Verbinden..."
|
||||
|
||||
#: ../../../ui.cpp:1981
|
||||
msgid "Unable to connect"
|
||||
msgstr "Kan niet verbinden"
|
||||
|
||||
#: ../../../ui.cpp:1986
|
||||
msgid "Requesting public key..."
|
||||
msgstr "Aanvragen van publieke sleutel..."
|
||||
|
||||
#: ../../../ui.cpp:1998
|
||||
msgid "Received public key..."
|
||||
msgstr "Publieke sleutel ontvangen..."
|
||||
|
||||
#: ../../../ui.cpp:2010
|
||||
msgid "Transfer was not accepted"
|
||||
msgstr "Transactie niet geaccepteerd"
|
||||
|
||||
#: ../../../ui.cpp:2019
|
||||
msgid "Invalid response received"
|
||||
msgstr "Foutief antwoord ontvangen"
|
||||
|
||||
#: ../../../ui.cpp:2034
|
||||
msgid "Creating transaction..."
|
||||
msgstr "Maakt transactie aan..."
|
||||
|
||||
#: ../../../ui.cpp:2046
|
||||
#, c-format
|
||||
msgid "This is an oversized transaction that requires a transaction fee of %s"
|
||||
msgstr "Dit is een te grote transactie die een transactie fooi vereist van %s"
|
||||
|
||||
#: ../../../ui.cpp:2048
|
||||
msgid "Transaction creation failed"
|
||||
msgstr "Transactie aanmaak gefaald."
|
||||
|
||||
#: ../../../ui.cpp:2055
|
||||
msgid "Transaction aborted"
|
||||
msgstr "Transactie geannuleerd"
|
||||
|
||||
#: ../../../ui.cpp:2063
|
||||
msgid "Lost connection, transaction cancelled"
|
||||
msgstr "Verbinding verloren, transactie geannuleerd"
|
||||
|
||||
#: ../../../ui.cpp:2079
|
||||
msgid "Sending payment..."
|
||||
msgstr "Versturen van betaling..."
|
||||
|
||||
#: ../../../ui.cpp:2085
|
||||
msgid "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."
|
||||
msgstr "De transactie was afgekeurd. Dit kan komen als bepaalde coins in uw Portefeuille al zijn uitgegeven. Dit kan komen doordat u wallet.dat heeft gekopieerd en wat coins heeft uitgegeven en niet terug gekopieerd heeft."
|
||||
|
||||
#: ../../../ui.cpp:2092
|
||||
msgid "Waiting for confirmation..."
|
||||
msgstr "Wachten op bevestiging..."
|
||||
|
||||
#: ../../../ui.cpp:2110
|
||||
msgid ""
|
||||
"The payment was sent, but the recipient was unable to verify it.\n"
|
||||
"The transaction is recorded and will credit to the recipient,\n"
|
||||
"but the comment information will be blank."
|
||||
msgstr ""
|
||||
"De betaling was verstuurd, maar de ontvanger kon het niet verifieeren.\n"
|
||||
"De transactie is opgenomen en word uitbetaald aan de ontvanger,\n"
|
||||
"maar de mededeling blijft blank bij de ontanger."
|
||||
|
||||
#: ../../../ui.cpp:2119
|
||||
msgid "Payment was sent, but an invalid response was received"
|
||||
msgstr "Betaling was verstuurd, maar een foutief antword was ontvangen."
|
||||
|
||||
#: ../../../ui.cpp:2125
|
||||
msgid "Payment completed"
|
||||
msgstr "Betaling voltooid"
|
||||
|
||||
#: ../../../ui.cpp:2156
|
||||
#: ../../../ui.cpp:2302
|
||||
#: ../../../ui.cpp:2339
|
||||
msgid "Name"
|
||||
msgstr "Naam"
|
||||
|
||||
#: ../../../ui.cpp:2157
|
||||
#: ../../../ui.cpp:2302
|
||||
#: ../../../ui.cpp:2339
|
||||
msgid "Address"
|
||||
msgstr "Adres"
|
||||
|
||||
#: ../../../ui.cpp:2159
|
||||
#: ../../../ui.cpp:2314
|
||||
msgid "Label"
|
||||
msgstr "Label"
|
||||
|
||||
#: ../../../ui.cpp:2160
|
||||
#: ../../../uibase.cpp:908
|
||||
msgid "Bitcoin Address"
|
||||
msgstr "Bitcoin Adres"
|
||||
|
||||
#: ../../../ui.cpp:2284
|
||||
msgid "This is one of your own addresses for receiving payments and cannot be entered in the address book. "
|
||||
msgstr "Dit is een van uw eigen adressen voor het ontvangen van betalingen en can niet worden toegevoegd aan uw adressen boek. "
|
||||
|
||||
#: ../../../ui.cpp:2302
|
||||
#: ../../../ui.cpp:2308
|
||||
msgid "Edit Address"
|
||||
msgstr "Bewerk Adres"
|
||||
|
||||
#: ../../../ui.cpp:2314
|
||||
msgid "Edit Address Label"
|
||||
msgstr "Bewerk Adres Label"
|
||||
|
||||
#: ../../../ui.cpp:2339
|
||||
#: ../../../ui.cpp:2345
|
||||
msgid "Add Address"
|
||||
msgstr "Adres Toevoegen"
|
||||
|
||||
#: ../../../ui.cpp:2421
|
||||
msgid "Bitcoin"
|
||||
msgstr "Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:2423
|
||||
msgid "Bitcoin - Generating"
|
||||
msgstr "Bitcoin - Genereert"
|
||||
|
||||
#: ../../../ui.cpp:2425
|
||||
msgid "Bitcoin - (not connected)"
|
||||
msgstr "Bitcoin - (niet verbonden)"
|
||||
|
||||
#: ../../../ui.cpp:2500
|
||||
msgid "&Open Bitcoin"
|
||||
msgstr "&Open Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:2501
|
||||
msgid "O&ptions..."
|
||||
msgstr "O&pties"
|
||||
|
||||
#: ../../../ui.cpp:2502
|
||||
#: ../../../uibase.cpp:34
|
||||
msgid "&Generate Coins"
|
||||
msgstr "&Genereer Coins"
|
||||
|
||||
#: ../../../ui.cpp:2505
|
||||
#: ../../../uibase.cpp:27
|
||||
msgid "E&xit"
|
||||
msgstr "A&fsluiten"
|
||||
|
||||
#: ../../../uibase.cpp:30
|
||||
msgid "&File"
|
||||
msgstr "&Bestand"
|
||||
|
||||
#: ../../../uibase.cpp:38
|
||||
msgid "&Your Receiving Addresses..."
|
||||
msgstr "&Uw Ontvang Adressen..."
|
||||
|
||||
#: ../../../uibase.cpp:42
|
||||
msgid "&Options..."
|
||||
msgstr "&Opties..."
|
||||
|
||||
#: ../../../uibase.cpp:45
|
||||
msgid "&Settings"
|
||||
msgstr "&Eigenschappen"
|
||||
|
||||
#: ../../../uibase.cpp:49
|
||||
msgid "&About..."
|
||||
msgstr "&Over..."
|
||||
|
||||
#: ../../../uibase.cpp:52
|
||||
msgid "&Help"
|
||||
msgstr "&Help"
|
||||
|
||||
#: ../../../uibase.cpp:62
|
||||
msgid "Address Book"
|
||||
msgstr "Adressen Boek"
|
||||
|
||||
#: ../../../uibase.cpp:77
|
||||
msgid "Your Bitcoin Address:"
|
||||
msgstr "Uw Bitcoin Address:"
|
||||
|
||||
#: ../../../uibase.cpp:84
|
||||
msgid " &New... "
|
||||
msgstr " &Nieuw... "
|
||||
|
||||
#: ../../../uibase.cpp:87
|
||||
#: ../../../uibase.cpp:851
|
||||
#: ../../../uibase.cpp:954
|
||||
msgid " &Copy to Clipboard "
|
||||
msgstr " &Kopieer naar Plakboord "
|
||||
|
||||
#: ../../../uibase.cpp:102
|
||||
msgid "Balance:"
|
||||
msgstr "Balans:"
|
||||
|
||||
#: ../../../uibase.cpp:121
|
||||
msgid " All"
|
||||
msgstr " Alles"
|
||||
|
||||
#: ../../../uibase.cpp:121
|
||||
msgid " Sent"
|
||||
msgstr " Verstuurd"
|
||||
|
||||
#: ../../../uibase.cpp:121
|
||||
msgid " Received"
|
||||
msgstr " Ontvangen"
|
||||
|
||||
#: ../../../uibase.cpp:121
|
||||
msgid " In Progress"
|
||||
msgstr " Word Verwerkt"
|
||||
|
||||
#: ../../../uibase.cpp:142
|
||||
msgid "All Transactions"
|
||||
msgstr "Alle transacties"
|
||||
|
||||
#: ../../../uibase.cpp:153
|
||||
msgid "Sent/Received"
|
||||
msgstr "Verstuurd/Ontvangen"
|
||||
|
||||
#: ../../../uibase.cpp:164
|
||||
msgid "Sent"
|
||||
msgstr "Verstuurd"
|
||||
|
||||
#: ../../../uibase.cpp:175
|
||||
msgid "Received"
|
||||
msgstr "Ontvangen"
|
||||
|
||||
#: ../../../uibase.cpp:318
|
||||
#: ../../../uibase.cpp:479
|
||||
#: ../../../uibase.cpp:580
|
||||
#: ../../../uibase.cpp:793
|
||||
#: ../../../uibase.cpp:854
|
||||
#: ../../../uibase.cpp:963
|
||||
#: ../../../uibase.cpp:1052
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: ../../../uibase.cpp:361
|
||||
msgid "Optional transaction fee you give to the nodes that process your transactions."
|
||||
msgstr "Optionele transactie fooi die u geeft aan de nodes doe uw betaling verwerken."
|
||||
|
||||
#: ../../../uibase.cpp:370
|
||||
msgid "Transaction fee:"
|
||||
msgstr "Transactie fooi:"
|
||||
|
||||
#: ../../../uibase.cpp:386
|
||||
msgid "&Limit coin generation to"
|
||||
msgstr "&Limiteer coin generatie tot"
|
||||
|
||||
#: ../../../uibase.cpp:393
|
||||
msgid "processors"
|
||||
msgstr "processors"
|
||||
|
||||
#: ../../../uibase.cpp:399
|
||||
msgid "&Start Bitcoin on system startup"
|
||||
msgstr "&Start Bitcoin wanneer het systeem opstart"
|
||||
|
||||
#: ../../../uibase.cpp:403
|
||||
msgid "&Minimize to the tray instead of the taskbar"
|
||||
msgstr "&Minimalizeer tot systeemvak inplaats van taakbalk"
|
||||
|
||||
#: ../../../uibase.cpp:407
|
||||
msgid "M&inimize to the tray on close"
|
||||
msgstr "M&inimalizeer tot taakbalk bij sluiten"
|
||||
|
||||
#: ../../../uibase.cpp:414
|
||||
msgid "&Connect through socks4 proxy: "
|
||||
msgstr "&Verbind via socks4 proxy: "
|
||||
|
||||
#: ../../../uibase.cpp:426
|
||||
msgid "Proxy &IP:"
|
||||
msgstr "Proxy &IP:"
|
||||
|
||||
#: ../../../uibase.cpp:434
|
||||
msgid " &Port:"
|
||||
msgstr " &Poort:"
|
||||
|
||||
#: ../../../uibase.cpp:456
|
||||
msgid "// [don't translate] Test panel 2 for future expansion"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../uibase.cpp:460
|
||||
msgid "// [don't translate] Let's not start multiple pages until the first page is filled up"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../uibase.cpp:482
|
||||
#: ../../../uibase.cpp:735
|
||||
#: ../../../uibase.cpp:798
|
||||
#: ../../../uibase.cpp:857
|
||||
#: ../../../uibase.cpp:966
|
||||
#: ../../../uibase.cpp:1055
|
||||
msgid "Cancel"
|
||||
msgstr "Annuleer"
|
||||
|
||||
#: ../../../uibase.cpp:485
|
||||
msgid "&Apply"
|
||||
msgstr "&Toepassen"
|
||||
|
||||
#: ../../../uibase.cpp:546
|
||||
msgid "Bitcoin "
|
||||
msgstr "Bitcoin "
|
||||
|
||||
#: ../../../uibase.cpp:552
|
||||
msgid "version"
|
||||
msgstr "versie"
|
||||
|
||||
#: ../../../uibase.cpp:563
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"\n"
|
||||
"This is experimental software. Do not rely on it for actual financial transactions.\n"
|
||||
"\n"
|
||||
"Distributed under the MIT/X11 software license, see the accompanying file \n"
|
||||
"license.txt or http://www.opensource.org/licenses/mit-license.php.\n"
|
||||
"\n"
|
||||
"This product includes software developed by the OpenSSL Project for use in the \n"
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"\n"
|
||||
"Dit is experimentele software. Vertrouw niet op het voor echte financiele transacties.\n"
|
||||
"\n"
|
||||
"Gedistributeerd onder de MIT/X11 software licentie, see het bijbehorende bestand \n"
|
||||
"license.txt of \"http://www.opensource.org/licenses/mit-license.php.\n"
|
||||
"\n"
|
||||
"Dit product komt met software ontwikkeld door het OpenSSL Project for gebruik in de\n"
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and de cryptografische software geschreven door \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
|
||||
#: ../../../uibase.cpp:619
|
||||
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"
|
||||
msgstr "Voer een Bitcoin adres (bijvoorbeeld: 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) of IP address (bijvoorbeeld: 123.45.6.7) in."
|
||||
|
||||
#: ../../../uibase.cpp:633
|
||||
msgid "Pay &To:"
|
||||
msgstr "Betaal &Naar:"
|
||||
|
||||
#: ../../../uibase.cpp:648
|
||||
msgid "&Paste"
|
||||
msgstr "&Plakken"
|
||||
|
||||
#: ../../../uibase.cpp:651
|
||||
msgid " Address &Book..."
|
||||
msgstr " Adressen &Boek..."
|
||||
|
||||
#: ../../../uibase.cpp:658
|
||||
msgid "&Amount:"
|
||||
msgstr "&Hoeveelheid:"
|
||||
|
||||
#: ../../../uibase.cpp:668
|
||||
msgid "T&ransfer:"
|
||||
msgstr "O&verdracht:"
|
||||
|
||||
#: ../../../uibase.cpp:674
|
||||
msgid " Standard"
|
||||
msgstr " Standaard"
|
||||
|
||||
#: ../../../uibase.cpp:696
|
||||
msgid "&From:"
|
||||
msgstr "&Van:"
|
||||
|
||||
#: ../../../uibase.cpp:713
|
||||
msgid "&Message:"
|
||||
msgstr "&Mededeling:"
|
||||
|
||||
#: ../../../uibase.cpp:730
|
||||
msgid "&Send"
|
||||
msgstr "&Verstuur"
|
||||
|
||||
#: ../../../uibase.cpp:782
|
||||
msgid ""
|
||||
"\n"
|
||||
"\n"
|
||||
"Connecting..."
|
||||
msgstr ""
|
||||
"\n"
|
||||
"\n"
|
||||
"Verbinden..."
|
||||
|
||||
#: ../../../uibase.cpp:832
|
||||
msgid "These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you. The highlighted address is displayed in the main window."
|
||||
msgstr "Dit zijn uw Bitcoin Adressen voor het ontvangen van betalingen. Misschien wilt u elk contact persoon een ander adres geven zodat u kunt bij houden wie er u heeft betaald. De opgelichte adressen worden weergeven in het hoofd venster."
|
||||
|
||||
#: ../../../uibase.cpp:845
|
||||
#: ../../../uibase.cpp:957
|
||||
msgid "&Edit..."
|
||||
msgstr "&Bewerk..."
|
||||
|
||||
#: ../../../uibase.cpp:848
|
||||
#: ../../../uibase.cpp:960
|
||||
msgid " &New Address... "
|
||||
msgstr " &New Adres... "
|
||||
|
||||
#: ../../../uibase.cpp:920
|
||||
msgid "Sending"
|
||||
msgstr "Versturen"
|
||||
|
||||
#: ../../../uibase.cpp:928
|
||||
msgid "These are your Bitcoin addresses for receiving payments. You can give a different one to each sender to keep track of who is paying you. The highlighted address will be displayed in the main window."
|
||||
msgstr "Dit zijn uw Bitcoin adressen voor het ontvangen van betalingen. U kunt een aan elk contact persoon geven zodat u een overzicht kunt houden wie u betaald. Dit adres zal wergeven worden in het hoofd main venster."
|
||||
|
||||
#: ../../../uibase.cpp:941
|
||||
msgid "Receiving"
|
||||
msgstr "Ontvangen"
|
||||
|
||||
#: ../../../uibase.cpp:951
|
||||
msgid "&Delete"
|
||||
msgstr "&Verwijder"
|
||||
|
||||
#: ../../../uibase.h:150
|
||||
msgid "Transaction Details"
|
||||
msgstr "Transactie Details"
|
||||
|
||||
#: ../../../uibase.h:203
|
||||
msgid "Options"
|
||||
msgstr "Opties"
|
||||
|
||||
#: ../../../uibase.h:231
|
||||
msgid "About Bitcoin"
|
||||
msgstr "Over Bitcoin"
|
||||
|
||||
#: ../../../uibase.h:341
|
||||
msgid "Your Bitcoin Addresses"
|
||||
msgstr "Uw Bitcoin Adressen"
|
||||
190
main.cpp
190
main.cpp
@@ -49,12 +49,16 @@ CCriticalSection cs_mapRequestCount;
|
||||
map<string, string> mapAddressBook;
|
||||
CCriticalSection cs_mapAddressBook;
|
||||
|
||||
vector<unsigned char> vchDefaultKey;
|
||||
|
||||
// Settings
|
||||
int fGenerateBitcoins = false;
|
||||
int64 nTransactionFee = 0;
|
||||
CAddress addrIncoming;
|
||||
int fLimitProcessors = false;
|
||||
int nLimitProcessors = 1;
|
||||
int fMinimizeToTray = true;
|
||||
int fMinimizeOnClose = true;
|
||||
|
||||
|
||||
|
||||
@@ -140,6 +144,19 @@ bool AddToWallet(const CWalletTx& wtxIn)
|
||||
if (!wtx.WriteToDisk())
|
||||
return false;
|
||||
|
||||
// If default receiving address gets used, replace it with a new one
|
||||
CScript scriptDefaultKey;
|
||||
scriptDefaultKey.SetBitcoinAddress(vchDefaultKey);
|
||||
foreach(const CTxOut& txout, wtx.vout)
|
||||
{
|
||||
if (txout.scriptPubKey == scriptDefaultKey)
|
||||
{
|
||||
CWalletDB walletdb;
|
||||
walletdb.WriteDefaultKey(GenerateNewKey());
|
||||
walletdb.WriteName(PubKeyToAddress(vchDefaultKey), "");
|
||||
}
|
||||
}
|
||||
|
||||
// Notify UI
|
||||
vWalletUpdated.push_back(hash);
|
||||
}
|
||||
@@ -1334,19 +1351,12 @@ bool CBlock::AcceptBlock()
|
||||
if (!AddToBlockIndex(nFile, nBlockPos))
|
||||
return error("AcceptBlock() : AddToBlockIndex failed");
|
||||
|
||||
// Don't relay old inventory during initial block download.
|
||||
// Please keep this number updated to a few thousand below current block count.
|
||||
if (hashBestChain == hash && nBestHeight > 40000)
|
||||
RelayInventory(CInv(MSG_BLOCK, hash));
|
||||
|
||||
// // Add atoms to user reviews for coins created
|
||||
// vector<unsigned char> vchPubKey;
|
||||
// if (ExtractPubKey(vtx[0].vout[0].scriptPubKey, false, vchPubKey))
|
||||
// {
|
||||
// unsigned short nAtom = GetRand(USHRT_MAX - 100) + 100;
|
||||
// vector<unsigned short> vAtoms(1, nAtom);
|
||||
// AddAtomsAndPropagate(Hash(vchPubKey.begin(), vchPubKey.end()), vAtoms, true);
|
||||
// }
|
||||
// Relay inventory, but don't relay old inventory during initial block download
|
||||
if (hashBestChain == hash)
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
foreach(CNode* pnode, vNodes)
|
||||
if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : 55000))
|
||||
pnode->PushInventory(CInv(MSG_BLOCK, hash));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1719,6 +1729,7 @@ bool ProcessMessages(CNode* pfrom)
|
||||
// (4) message start
|
||||
// (12) command
|
||||
// (4) size
|
||||
// (4) checksum
|
||||
// (x) data
|
||||
//
|
||||
|
||||
@@ -1726,12 +1737,13 @@ bool ProcessMessages(CNode* pfrom)
|
||||
{
|
||||
// Scan for message start
|
||||
CDataStream::iterator pstart = search(vRecv.begin(), vRecv.end(), BEGIN(pchMessageStart), END(pchMessageStart));
|
||||
if (vRecv.end() - pstart < sizeof(CMessageHeader))
|
||||
int nHeaderSize = vRecv.GetSerializeSize(CMessageHeader());
|
||||
if (vRecv.end() - pstart < nHeaderSize)
|
||||
{
|
||||
if (vRecv.size() > sizeof(CMessageHeader))
|
||||
if (vRecv.size() > nHeaderSize)
|
||||
{
|
||||
printf("\n\nPROCESSMESSAGE MESSAGESTART NOT FOUND\n\n");
|
||||
vRecv.erase(vRecv.begin(), vRecv.end() - sizeof(CMessageHeader));
|
||||
vRecv.erase(vRecv.begin(), vRecv.end() - nHeaderSize);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1740,6 +1752,7 @@ bool ProcessMessages(CNode* pfrom)
|
||||
vRecv.erase(vRecv.begin(), pstart);
|
||||
|
||||
// Read header
|
||||
vector<char> vHeaderSave(vRecv.begin(), vRecv.begin() + nHeaderSize);
|
||||
CMessageHeader hdr;
|
||||
vRecv >> hdr;
|
||||
if (!hdr.IsValid())
|
||||
@@ -1755,10 +1768,7 @@ bool ProcessMessages(CNode* pfrom)
|
||||
{
|
||||
// Rewind and wait for rest of message
|
||||
///// need a mechanism to give up waiting for overlong message size error
|
||||
//if (fDebug)
|
||||
// printf("message-break\n");
|
||||
vRecv.insert(vRecv.begin(), BEGIN(hdr), END(hdr));
|
||||
Sleep(100);
|
||||
vRecv.insert(vRecv.begin(), vHeaderSave.begin(), vHeaderSave.end());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1766,6 +1776,20 @@ bool ProcessMessages(CNode* pfrom)
|
||||
CDataStream vMsg(vRecv.begin(), vRecv.begin() + nMessageSize, vRecv.nType, vRecv.nVersion);
|
||||
vRecv.ignore(nMessageSize);
|
||||
|
||||
// Checksum
|
||||
if (vRecv.GetVersion() >= 209)
|
||||
{
|
||||
uint256 hash = Hash(vMsg.begin(), vMsg.end());
|
||||
unsigned int nChecksum = 0;
|
||||
memcpy(&nChecksum, &hash, sizeof(nChecksum));
|
||||
if (nChecksum != hdr.nChecksum)
|
||||
{
|
||||
printf("ProcessMessage(%s, %d bytes) : CHECKSUM ERROR nChecksum=%08x hdr.nChecksum=%08x\n",
|
||||
strCommand.c_str(), nMessageSize, nChecksum, hdr.nChecksum);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Process message
|
||||
bool fRet = false;
|
||||
try
|
||||
@@ -1842,6 +1866,9 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
vRecv >> addrFrom >> nNonce;
|
||||
if (pfrom->nVersion >= 106 && !vRecv.empty())
|
||||
vRecv >> strSubVer;
|
||||
if (pfrom->nVersion >= 209 && !vRecv.empty())
|
||||
vRecv >> pfrom->nStartingHeight;
|
||||
|
||||
if (pfrom->nVersion == 0)
|
||||
return false;
|
||||
|
||||
@@ -1852,9 +1879,6 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
return true;
|
||||
}
|
||||
|
||||
pfrom->vSend.SetVersion(min(pfrom->nVersion, VERSION));
|
||||
pfrom->vRecv.SetVersion(min(pfrom->nVersion, VERSION));
|
||||
|
||||
pfrom->fClient = !(pfrom->nServices & NODE_NETWORK);
|
||||
if (pfrom->fClient)
|
||||
{
|
||||
@@ -1864,6 +1888,13 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
|
||||
AddTimeData(pfrom->addr.ip, nTime);
|
||||
|
||||
// Change version
|
||||
if (pfrom->nVersion >= 209)
|
||||
pfrom->PushMessage("verack");
|
||||
pfrom->vSend.SetVersion(min(pfrom->nVersion, VERSION));
|
||||
if (pfrom->nVersion < 209)
|
||||
pfrom->vRecv.SetVersion(min(pfrom->nVersion, VERSION));
|
||||
|
||||
// Ask the first connected node for block updates
|
||||
static bool fAskedForBlocks;
|
||||
if (!fAskedForBlocks && !pfrom->fClient)
|
||||
@@ -1874,7 +1905,7 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
|
||||
pfrom->fSuccessfullyConnected = true;
|
||||
|
||||
printf("version message: version %d\n", pfrom->nVersion);
|
||||
printf("version message: version %d, blocks=%d\n", pfrom->nVersion, pfrom->nStartingHeight);
|
||||
}
|
||||
|
||||
|
||||
@@ -1885,11 +1916,19 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
}
|
||||
|
||||
|
||||
else if (strCommand == "verack")
|
||||
{
|
||||
pfrom->vRecv.SetVersion(min(pfrom->nVersion, VERSION));
|
||||
}
|
||||
|
||||
|
||||
else if (strCommand == "addr")
|
||||
{
|
||||
vector<CAddress> vAddr;
|
||||
vRecv >> vAddr;
|
||||
if (vAddr.size() > 50000) // lower this to 1000 later
|
||||
if (pfrom->nVersion < 200) // don't want addresses from 0.1.5
|
||||
return true;
|
||||
if (vAddr.size() > 1000)
|
||||
return error("message addr size() = %d", vAddr.size());
|
||||
|
||||
// Store the new addresses
|
||||
@@ -1898,19 +1937,26 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
if (fShutdown)
|
||||
return true;
|
||||
addr.nTime = GetAdjustedTime() - 2 * 60 * 60;
|
||||
if (pfrom->fGetAddr)
|
||||
if (pfrom->fGetAddr || vAddr.size() > 10)
|
||||
addr.nTime -= 5 * 24 * 60 * 60;
|
||||
AddAddress(addr, false);
|
||||
pfrom->AddAddressKnown(addr);
|
||||
if (!pfrom->fGetAddr && addr.IsRoutable())
|
||||
{
|
||||
// Put on lists to send to other nodes
|
||||
// Relay to a limited number of other nodes
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
{
|
||||
multimap<int, CNode*> mapMix;
|
||||
foreach(CNode* pnode, vNodes)
|
||||
pnode->PushAddress(addr);
|
||||
mapMix.insert(make_pair(GetRand(INT_MAX), pnode));
|
||||
int nRelayNodes = 5;
|
||||
for (multimap<int, CNode*>::iterator mi = mapMix.begin(); mi != mapMix.end() && nRelayNodes-- > 0; ++mi)
|
||||
((*mi).second)->PushAddress(addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
pfrom->fGetAddr = false;
|
||||
if (vAddr.size() < 1000)
|
||||
pfrom->fGetAddr = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2099,9 +2145,8 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
vRecv >> *pblock;
|
||||
|
||||
//// debug print
|
||||
// printf("received block:\n");
|
||||
// pblock->print();
|
||||
printf("received block %s\n", pblock->GetHash().ToString().substr(0,16).c_str());
|
||||
// pblock->print();
|
||||
|
||||
CInv inv(MSG_BLOCK, pblock->GetHash());
|
||||
pfrom->AddInventoryKnown(inv);
|
||||
@@ -2154,6 +2199,7 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
uint256 hashReply;
|
||||
CWalletTx wtxNew;
|
||||
vRecv >> hashReply >> wtxNew;
|
||||
wtxNew.fFromMe = false;
|
||||
|
||||
// Broadcast
|
||||
if (!wtxNew.AcceptWalletTransaction())
|
||||
@@ -2219,7 +2265,7 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
|
||||
|
||||
|
||||
bool SendMessages(CNode* pto)
|
||||
bool SendMessages(CNode* pto, bool fSendTrickle)
|
||||
{
|
||||
CRITICAL_BLOCK(cs_main)
|
||||
{
|
||||
@@ -2250,15 +2296,6 @@ bool SendMessages(CNode* pto)
|
||||
}
|
||||
}
|
||||
|
||||
// Delay tx inv messages to protect privacy,
|
||||
// trickle them out to a few nodes at a time.
|
||||
bool fSendTxInv = false;
|
||||
if (GetTimeMillis() - pto->nLastSentTxInv > 1800 + GetRand(200))
|
||||
{
|
||||
pto->nLastSentTxInv = GetTimeMillis();
|
||||
fSendTxInv = true;
|
||||
}
|
||||
|
||||
// Resend wallet transactions that haven't gotten in a block yet
|
||||
ResendWalletTransactions();
|
||||
|
||||
@@ -2266,24 +2303,28 @@ bool SendMessages(CNode* pto)
|
||||
//
|
||||
// Message: addr
|
||||
//
|
||||
vector<CAddress> vAddr;
|
||||
vAddr.reserve(pto->vAddrToSend.size());
|
||||
foreach(const CAddress& addr, pto->vAddrToSend)
|
||||
if (fSendTrickle)
|
||||
{
|
||||
// returns true if wasn't already contained in the set
|
||||
if (pto->setAddrKnown.insert(addr).second)
|
||||
vector<CAddress> vAddr;
|
||||
vAddr.reserve(pto->vAddrToSend.size());
|
||||
foreach(const CAddress& addr, pto->vAddrToSend)
|
||||
{
|
||||
vAddr.push_back(addr);
|
||||
if (vAddr.size() >= 1000)
|
||||
// returns true if wasn't already contained in the set
|
||||
if (pto->setAddrKnown.insert(addr).second)
|
||||
{
|
||||
pto->PushMessage("addr", vAddr);
|
||||
vAddr.clear();
|
||||
vAddr.push_back(addr);
|
||||
// receiver rejects addr messages larger than 1000
|
||||
if (vAddr.size() >= 1000)
|
||||
{
|
||||
pto->PushMessage("addr", vAddr);
|
||||
vAddr.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
pto->vAddrToSend.clear();
|
||||
if (!vAddr.empty())
|
||||
pto->PushMessage("addr", vAddr);
|
||||
}
|
||||
pto->vAddrToSend.clear();
|
||||
if (!vAddr.empty())
|
||||
pto->PushMessage("addr", vAddr);
|
||||
|
||||
|
||||
//
|
||||
@@ -2297,11 +2338,40 @@ bool SendMessages(CNode* pto)
|
||||
vInvWait.reserve(pto->vInventoryToSend.size());
|
||||
foreach(const CInv& inv, pto->vInventoryToSend)
|
||||
{
|
||||
// delay txes
|
||||
if (!fSendTxInv && inv.type == MSG_TX)
|
||||
{
|
||||
vInvWait.push_back(inv);
|
||||
if (pto->setInventoryKnown.count(inv))
|
||||
continue;
|
||||
|
||||
// trickle out tx inv to protect privacy
|
||||
if (inv.type == MSG_TX && !fSendTrickle)
|
||||
{
|
||||
// 1/4 of tx invs blast to all immediately
|
||||
static uint256 hashSalt;
|
||||
if (hashSalt == 0)
|
||||
RAND_bytes((unsigned char*)&hashSalt, sizeof(hashSalt));
|
||||
uint256 hashRand = (inv.hash ^ hashSalt);
|
||||
hashRand = Hash(BEGIN(hashRand), END(hashRand));
|
||||
bool fTrickleWait = ((hashRand & 3) != 0);
|
||||
|
||||
// always trickle our own transactions
|
||||
if (!fTrickleWait)
|
||||
{
|
||||
TRY_CRITICAL_BLOCK(cs_mapWallet)
|
||||
{
|
||||
map<uint256, CWalletTx>::iterator mi = mapWallet.find(inv.hash);
|
||||
if (mi != mapWallet.end())
|
||||
{
|
||||
CWalletTx& wtx = (*mi).second;
|
||||
if (wtx.fFromMe)
|
||||
fTrickleWait = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fTrickleWait)
|
||||
{
|
||||
vInvWait.push_back(inv);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// returns true if wasn't already contained in the set
|
||||
@@ -2386,8 +2456,11 @@ void GenerateBitcoins(bool fGenerate)
|
||||
int nAddThreads = nProcessors - vnThreadsRunning[3];
|
||||
printf("Starting %d BitcoinMiner threads\n", nAddThreads);
|
||||
for (int i = 0; i < nAddThreads; i++)
|
||||
{
|
||||
if (!CreateThread(ThreadBitcoinMiner, NULL))
|
||||
printf("Error: CreateThread(ThreadBitcoinMiner) failed\n");
|
||||
Sleep(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2826,6 +2899,7 @@ bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CK
|
||||
{
|
||||
wtxNew.vin.clear();
|
||||
wtxNew.vout.clear();
|
||||
wtxNew.fFromMe = true;
|
||||
if (nValue < 0)
|
||||
return false;
|
||||
int64 nValueOut = nValue;
|
||||
@@ -2990,7 +3064,7 @@ string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtx
|
||||
if (nValue <= 0)
|
||||
return _("Invalid amount");
|
||||
if (nValue + nTransactionFee > GetBalance())
|
||||
return _("You don't have enough money");
|
||||
return _("Insufficient funds");
|
||||
|
||||
// Parse bitcoin address
|
||||
CScript scriptPubKey;
|
||||
|
||||
5
main.h
5
main.h
@@ -38,6 +38,7 @@ extern map<uint256, int> mapRequestCount;
|
||||
extern CCriticalSection cs_mapRequestCount;
|
||||
extern map<string, string> mapAddressBook;
|
||||
extern CCriticalSection cs_mapAddressBook;
|
||||
extern vector<unsigned char> vchDefaultKey;
|
||||
|
||||
// Settings
|
||||
extern int fGenerateBitcoins;
|
||||
@@ -45,6 +46,8 @@ extern int64 nTransactionFee;
|
||||
extern CAddress addrIncoming;
|
||||
extern int fLimitProcessors;
|
||||
extern int nLimitProcessors;
|
||||
extern int fMinimizeToTray;
|
||||
extern int fMinimizeOnClose;
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +67,7 @@ bool LoadBlockIndex(bool fAllowNew=true);
|
||||
void PrintBlockTree();
|
||||
bool ProcessMessages(CNode* pfrom);
|
||||
bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv);
|
||||
bool SendMessages(CNode* pto);
|
||||
bool SendMessages(CNode* pto, bool fSendTrickle);
|
||||
int64 GetBalance();
|
||||
bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CKey& keyRet, int64& nFeeRequiredRet);
|
||||
bool CommitTransaction(CWalletTx& wtxNew, const CKey& key);
|
||||
|
||||
@@ -18,69 +18,59 @@ LIBPATHS= \
|
||||
-L"/openssl/out" \
|
||||
-L"/wxwidgets/lib/gcc_lib"
|
||||
|
||||
WXLIBS= \
|
||||
-l wxmsw29ud_html -l wxmsw29ud_core -l wxmsw29ud_adv -l wxbase29ud -l wxtiffd -l wxjpegd -l wxpngd -l wxzlibd
|
||||
|
||||
LIBS= \
|
||||
-l libboost_system-mgw34-mt-d -l libboost_filesystem-mgw34-mt-d \
|
||||
-l db_cxx \
|
||||
-l eay32 \
|
||||
-l wxmsw29ud_html -l wxmsw29ud_core -l wxmsw29ud_adv -l wxbase29ud -l wxtiffd -l wxjpegd -l wxpngd -l wxzlibd \
|
||||
-l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi
|
||||
|
||||
WXDEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH
|
||||
DEBUGFLAGS=-g -D__WXDEBUG__
|
||||
CFLAGS=-mthreads -O0 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h
|
||||
|
||||
CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h
|
||||
|
||||
|
||||
all: bitcoin.exe
|
||||
|
||||
|
||||
headers.h.gch: headers.h $(HEADERS)
|
||||
headers.h.gch: headers.h $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/util.o: util.cpp $(HEADERS)
|
||||
obj/%.o: %.cpp $(HEADERS) headers.h.gch
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/script.o: script.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/db.o: db.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/net.o: net.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/main.o: main.cpp $(HEADERS) sha.h
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/ui.o: ui.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
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)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/rpc.o: rpc.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
|
||||
windres $(WXDEFS) $(INCLUDEPATHS) -o $@ -i $<
|
||||
|
||||
OBJS= \
|
||||
obj/util.o \
|
||||
obj/script.o \
|
||||
obj/db.o \
|
||||
obj/net.o \
|
||||
obj/irc.o \
|
||||
obj/main.o \
|
||||
obj/rpc.o \
|
||||
obj/init.o
|
||||
|
||||
bitcoin.exe: $(OBJS) obj/ui.o obj/uibase.o obj/sha.o obj/ui_res.o
|
||||
g++ $(CFLAGS) -mwindows -Wl,--subsystem,windows -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o \
|
||||
obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/rpc.o \
|
||||
obj/ui_res.o
|
||||
obj/nogui/%.o: %.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -DwxUSE_GUI=0 -o $@ $<
|
||||
|
||||
bitcoind.exe: $(OBJS:obj/%=obj/nogui/%) obj/sha.o obj/ui_res.o
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -l wxbase29ud $(LIBS)
|
||||
|
||||
bitcoin.exe: headers.h.gch $(OBJS)
|
||||
-kill /f bitcoin.exe
|
||||
g++ $(CFLAGS) -mwindows -Wl,--subsystem,windows -o $@ $(LIBPATHS) $(OBJS) $(LIBS)
|
||||
|
||||
clean:
|
||||
-del /Q obj\*
|
||||
-del /Q obj\nogui\*
|
||||
-del /Q headers.h.gch
|
||||
|
||||
65
makefile.osx
Normal file
65
makefile.osx
Normal file
@@ -0,0 +1,65 @@
|
||||
# Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
# Mac OS X makefile for bitcoin
|
||||
# Laszlo Hanyecz (solar@heliacal.net)
|
||||
|
||||
DEPSDIR=/Users/macosuser/bitcoin/deps
|
||||
|
||||
INCLUDEPATHS= \
|
||||
-I"$(DEPSDIR)/include"
|
||||
|
||||
LIBPATHS= \
|
||||
-L"$(DEPSDIR)/lib"
|
||||
|
||||
WXLIBS=$(shell $(DEPSDIR)/bin/wx-config --libs --static)
|
||||
|
||||
LIBS= -dead_strip \
|
||||
$(DEPSDIR)/lib/libdb_cxx-4.8.a \
|
||||
$(DEPSDIR)/lib/libboost_system.a \
|
||||
$(DEPSDIR)/lib/libboost_filesystem.a \
|
||||
$(DEPSDIR)/lib/libcrypto.a
|
||||
|
||||
WXDEFS=$(shell $(DEPSDIR)/bin/wx-config --cxxflags) -DNOPCH -DMSG_NOSIGNAL=0
|
||||
|
||||
DEBUGFLAGS=-g -DwxDEBUG_LEVEL=0
|
||||
# ppc doesn't work because we don't support big-endian
|
||||
CFLAGS=-mmacosx-version-min=10.5 -arch i386 -arch x86_64 -O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h
|
||||
|
||||
|
||||
all: bitcoin
|
||||
|
||||
|
||||
obj/%.o: %.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/sha.o: sha.cpp sha.h
|
||||
g++ -c $(CFLAGS) -O3 -o $@ $<
|
||||
|
||||
OBJS= \
|
||||
obj/util.o \
|
||||
obj/script.o \
|
||||
obj/db.o \
|
||||
obj/net.o \
|
||||
obj/irc.o \
|
||||
obj/main.o \
|
||||
obj/rpc.o \
|
||||
obj/init.o
|
||||
|
||||
bitcoin: $(OBJS) obj/ui.o obj/uibase.o obj/sha.o
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
obj/nogui/%.o: %.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -DwxUSE_GUI=0 -o $@ $<
|
||||
|
||||
bitcoind: $(OBJS:obj/%=obj/nogui/%) obj/sha.o
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
-rm -f obj/*.o
|
||||
-rm -f obj/nogui/*.o
|
||||
@@ -13,66 +13,61 @@ LIBPATHS= \
|
||||
-L"/usr/lib" \
|
||||
-L"/usr/local/lib"
|
||||
|
||||
WXLIBS= \
|
||||
-Wl,-Bstatic \
|
||||
-l wx_gtk2ud-2.9 \
|
||||
-Wl,-Bdynamic \
|
||||
-l gtk-x11-2.0 -l SM
|
||||
|
||||
LIBS= \
|
||||
-Wl,-Bstatic \
|
||||
-l boost_system-mt -l boost_filesystem-mt \
|
||||
-l db_cxx \
|
||||
-l wx_gtk2ud-2.9 \
|
||||
-Wl,-Bdynamic \
|
||||
-l crypto \
|
||||
-l gtk-x11-2.0 -l gthread-2.0 -l SM
|
||||
-l gthread-2.0
|
||||
|
||||
WXDEFS=-D__WXGTK__ -DNOPCH
|
||||
DEBUGFLAGS=-g -D__WXDEBUG__
|
||||
CFLAGS=-O0 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h
|
||||
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h
|
||||
|
||||
|
||||
all: bitcoin
|
||||
|
||||
|
||||
headers.h.gch: headers.h $(HEADERS)
|
||||
headers.h.gch: headers.h $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/util.o: util.cpp $(HEADERS)
|
||||
obj/%.o: %.cpp $(HEADERS) headers.h.gch
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/script.o: script.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/db.o: db.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/net.o: net.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/main.o: main.cpp $(HEADERS) sha.h
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj/ui.o: ui.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
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)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
OBJS= \
|
||||
obj/util.o \
|
||||
obj/script.o \
|
||||
obj/db.o \
|
||||
obj/net.o \
|
||||
obj/irc.o \
|
||||
obj/main.o \
|
||||
obj/rpc.o \
|
||||
obj/init.o
|
||||
|
||||
obj/rpc.o: rpc.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
bitcoin: $(OBJS) obj/ui.o obj/uibase.o obj/sha.o
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
obj/nogui/%.o: %.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -DwxUSE_GUI=0 -o $@ $<
|
||||
|
||||
OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o \
|
||||
obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/rpc.o
|
||||
bitcoind: $(OBJS:obj/%=obj/nogui/%) obj/sha.o
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -l wx_baseud-2.9 $(LIBS)
|
||||
|
||||
bitcoin: headers.h.gch $(OBJS)
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $(OBJS) $(LIBS)
|
||||
|
||||
clean:
|
||||
-rm obj/*
|
||||
-rm obj/nogui/*
|
||||
-rm headers.h.gch
|
||||
|
||||
81
makefile.vc
81
makefile.vc
@@ -28,56 +28,79 @@ LIBS= \
|
||||
WXDEFS=/DWIN32 /D__WXMSW__ /D_WINDOWS /DNOPCH
|
||||
DEBUGFLAGS=/Zi /Od /D__WXDEBUG__
|
||||
CFLAGS=/c /nologo /Ob0 /MDd /EHsc /GR /Zm300 $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h
|
||||
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h
|
||||
|
||||
|
||||
all: bitcoin.exe
|
||||
|
||||
|
||||
obj\util.obj: util.cpp $(HEADERS)
|
||||
.cpp{obj}.obj:
|
||||
cl $(CFLAGS) /Fo$@ %s
|
||||
|
||||
obj\script.obj: script.cpp $(HEADERS)
|
||||
cl $(CFLAGS) /Fo$@ %s
|
||||
obj\util.obj: $(HEADERS)
|
||||
|
||||
obj\db.obj: db.cpp $(HEADERS)
|
||||
cl $(CFLAGS) /Fo$@ %s
|
||||
obj\script.obj: $(HEADERS)
|
||||
|
||||
obj\net.obj: net.cpp $(HEADERS)
|
||||
cl $(CFLAGS) /Fo$@ %s
|
||||
obj\db.obj: $(HEADERS)
|
||||
|
||||
obj\main.obj: main.cpp $(HEADERS) sha.h
|
||||
cl $(CFLAGS) /Fo$@ %s
|
||||
obj\net.obj: $(HEADERS)
|
||||
|
||||
obj\ui.obj: ui.cpp $(HEADERS)
|
||||
cl $(CFLAGS) /Fo$@ %s
|
||||
obj\irc.obj: $(HEADERS)
|
||||
|
||||
obj\uibase.obj: uibase.cpp uibase.h
|
||||
cl $(CFLAGS) /Fo$@ %s
|
||||
obj\main.obj: $(HEADERS)
|
||||
|
||||
obj\sha.obj: sha.cpp sha.h
|
||||
obj\rpc.obj: $(HEADERS)
|
||||
|
||||
obj\init.obj: $(HEADERS)
|
||||
|
||||
obj\ui.obj: $(HEADERS)
|
||||
|
||||
obj\uibase.obj: $(HEADERS)
|
||||
|
||||
obj\sha.obj: sha.cpp sha.h
|
||||
cl $(CFLAGS) /O2 /Fo$@ %s
|
||||
|
||||
obj\irc.obj: irc.cpp $(HEADERS)
|
||||
cl $(CFLAGS) /Fo$@ %s
|
||||
|
||||
obj\rpc.obj: rpc.cpp $(HEADERS)
|
||||
cl $(CFLAGS) /Fo$@ %s
|
||||
|
||||
obj\ui.res: 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
|
||||
rc $(INCLUDEPATHS) $(WXDEFS) /Fo$@ %s
|
||||
|
||||
OBJS= \
|
||||
obj\util.obj \
|
||||
obj\script.obj \
|
||||
obj\db.obj \
|
||||
obj\net.obj \
|
||||
obj\irc.obj \
|
||||
obj\main.obj \
|
||||
obj\rpc.obj \
|
||||
obj\init.obj
|
||||
|
||||
|
||||
OBJS=obj\util.obj obj\script.obj obj\db.obj obj\net.obj obj\main.obj \
|
||||
obj\ui.obj obj\uibase.obj obj\sha.obj obj\irc.obj obj\rpc.obj \
|
||||
obj\ui.res
|
||||
|
||||
bitcoin.exe: $(OBJS)
|
||||
-kill /f bitcoin.exe & sleep 1
|
||||
bitcoin.exe: $(OBJS) obj\ui.obj obj\uibase.obj obj\sha.obj obj\ui.res
|
||||
link /nologo /DEBUG /SUBSYSTEM:WINDOWS /OUT:$@ $(LIBPATHS) $** $(LIBS)
|
||||
|
||||
|
||||
.cpp{obj\nogui}.obj:
|
||||
cl $(CFLAGS) /DwxUSE_GUI=0 /Fo$@ %s
|
||||
|
||||
obj\nogui\util.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\script.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\db.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\net.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\irc.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\main.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\rpc.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\init.obj: $(HEADERS)
|
||||
|
||||
bitcoind.exe: $(OBJS:obj\=obj\nogui\) obj\sha.obj obj\ui.res
|
||||
link /nologo /DEBUG /OUT:$@ $(LIBPATHS) $** $(LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
-del /Q obj\*
|
||||
-del *.ilk
|
||||
|
||||
19
net.cpp
19
net.cpp
@@ -927,9 +927,7 @@ void ThreadOpenConnections2(void* parg)
|
||||
continue;
|
||||
|
||||
// Only try the old stuff if we don't have enough connections
|
||||
if (vNodes.size() >= 2 && nSinceLastSeen > 7 * 24 * 60 * 60)
|
||||
continue;
|
||||
if (vNodes.size() >= 5 && nSinceLastSeen > 24 * 60 * 60)
|
||||
if (vNodes.size() >= 8 && nSinceLastSeen > 24 * 60 * 60)
|
||||
continue;
|
||||
|
||||
// If multiple addresses are ready, prioritize by time since
|
||||
@@ -970,9 +968,9 @@ bool OpenNetworkConnection(const CAddress& addrConnect)
|
||||
if (addrLocalHost.IsRoutable() && !fUseProxy)
|
||||
{
|
||||
// Advertise our address
|
||||
vector<CAddress> vAddrToSend;
|
||||
vAddrToSend.push_back(addrLocalHost);
|
||||
pnode->PushMessage("addr", vAddrToSend);
|
||||
vector<CAddress> vAddr;
|
||||
vAddr.push_back(addrLocalHost);
|
||||
pnode->PushMessage("addr", vAddr);
|
||||
}
|
||||
|
||||
// Get as many addresses as we can
|
||||
@@ -1021,7 +1019,6 @@ void ThreadMessageHandler2(void* parg)
|
||||
SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL);
|
||||
while (!fShutdown)
|
||||
{
|
||||
// Poll the connected nodes for messages
|
||||
vector<CNode*> vNodesCopy;
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
{
|
||||
@@ -1029,6 +1026,11 @@ void ThreadMessageHandler2(void* parg)
|
||||
foreach(CNode* pnode, vNodesCopy)
|
||||
pnode->AddRef();
|
||||
}
|
||||
|
||||
// Poll the connected nodes for messages
|
||||
CNode* pnodeTrickle = NULL;
|
||||
if (!vNodesCopy.empty())
|
||||
pnodeTrickle = vNodesCopy[GetRand(vNodesCopy.size())];
|
||||
foreach(CNode* pnode, vNodesCopy)
|
||||
{
|
||||
// Receive messages
|
||||
@@ -1039,10 +1041,11 @@ void ThreadMessageHandler2(void* parg)
|
||||
|
||||
// Send messages
|
||||
TRY_CRITICAL_BLOCK(pnode->cs_vSend)
|
||||
SendMessages(pnode);
|
||||
SendMessages(pnode, pnode == pnodeTrickle);
|
||||
if (fShutdown)
|
||||
return;
|
||||
}
|
||||
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
{
|
||||
foreach(CNode* pnode, vNodesCopy)
|
||||
|
||||
93
net.h
93
net.h
@@ -8,10 +8,11 @@ class CInv;
|
||||
class CRequestTracker;
|
||||
class CNode;
|
||||
class CBlockIndex;
|
||||
extern int nBestHeight;
|
||||
|
||||
|
||||
|
||||
static const unsigned short DEFAULT_PORT = htons(8333);
|
||||
#define DEFAULT_PORT htons(8333)
|
||||
static const unsigned int PUBLISH_HOPS = 5;
|
||||
enum
|
||||
{
|
||||
@@ -45,6 +46,7 @@ bool StopNode();
|
||||
// (4) message start
|
||||
// (12) command
|
||||
// (4) size
|
||||
// (4) checksum
|
||||
|
||||
// The message start string is designed to be unlikely to occur in normal data.
|
||||
// The characters are rarely used upper ascii, not valid as UTF-8, and produce
|
||||
@@ -58,6 +60,7 @@ public:
|
||||
char pchMessageStart[sizeof(::pchMessageStart)];
|
||||
char pchCommand[COMMAND_SIZE];
|
||||
unsigned int nMessageSize;
|
||||
unsigned int nChecksum;
|
||||
|
||||
CMessageHeader()
|
||||
{
|
||||
@@ -65,6 +68,7 @@ public:
|
||||
memset(pchCommand, 0, sizeof(pchCommand));
|
||||
pchCommand[1] = 1;
|
||||
nMessageSize = -1;
|
||||
nChecksum = 0;
|
||||
}
|
||||
|
||||
CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn)
|
||||
@@ -72,6 +76,7 @@ public:
|
||||
memcpy(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart));
|
||||
strncpy(pchCommand, pszCommand, COMMAND_SIZE);
|
||||
nMessageSize = nMessageSizeIn;
|
||||
nChecksum = 0;
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
@@ -79,6 +84,8 @@ public:
|
||||
READWRITE(FLATDATA(pchMessageStart));
|
||||
READWRITE(FLATDATA(pchCommand));
|
||||
READWRITE(nMessageSize);
|
||||
if (nVersion >= 209)
|
||||
READWRITE(nChecksum);
|
||||
)
|
||||
|
||||
string GetCommand()
|
||||
@@ -282,16 +289,24 @@ public:
|
||||
|
||||
bool IsRoutable() const
|
||||
{
|
||||
return !(GetByte(3) == 10 ||
|
||||
(GetByte(3) == 192 && GetByte(2) == 168) ||
|
||||
GetByte(3) == 127 ||
|
||||
GetByte(3) == 0 ||
|
||||
ip == 0 ||
|
||||
ip == INADDR_NONE);
|
||||
return IsValid() &&
|
||||
!(GetByte(3) == 10 ||
|
||||
(GetByte(3) == 192 && GetByte(2) == 168) ||
|
||||
GetByte(3) == 127 ||
|
||||
GetByte(3) == 0);
|
||||
}
|
||||
|
||||
bool IsValid() const
|
||||
{
|
||||
// Clean up 3-byte shifted addresses caused by garbage in size field
|
||||
// of addr messages from versions before 0.2.9 checksum.
|
||||
// Two consecutive addr messages look like this:
|
||||
// header20 vectorlen3 addr26 addr26 addr26 header20 vectorlen3 addr26 addr26 addr26...
|
||||
// so if the first length field is garbled, it reads the second batch
|
||||
// of addr misaligned by 3 bytes.
|
||||
if (memcmp(pchReserved, pchIPv4+3, sizeof(pchIPv4)-3) == 0)
|
||||
return false;
|
||||
|
||||
return (ip != 0 && ip != INADDR_NONE && port != htons(USHRT_MAX));
|
||||
}
|
||||
|
||||
@@ -470,6 +485,7 @@ extern CAddress addrProxy;
|
||||
|
||||
|
||||
|
||||
|
||||
class CNode
|
||||
{
|
||||
public:
|
||||
@@ -484,7 +500,8 @@ public:
|
||||
int64 nLastRecv;
|
||||
int64 nLastSendEmpty;
|
||||
int64 nTimeConnected;
|
||||
unsigned int nPushPos;
|
||||
unsigned int nHeaderStart;
|
||||
unsigned int nMessageStart;
|
||||
CAddress addr;
|
||||
int nVersion;
|
||||
bool fClient;
|
||||
@@ -501,6 +518,7 @@ public:
|
||||
uint256 hashContinue;
|
||||
CBlockIndex* pindexLastGetBlocksBegin;
|
||||
uint256 hashLastGetBlocksEnd;
|
||||
int nStartingHeight;
|
||||
|
||||
// flood
|
||||
vector<CAddress> vAddrToSend;
|
||||
@@ -512,7 +530,6 @@ public:
|
||||
vector<CInv> vInventoryToSend;
|
||||
CCriticalSection cs_inventory;
|
||||
multimap<int64, CInv> mapAskFor;
|
||||
int64 nLastSentTxInv;
|
||||
|
||||
// publish and subscription
|
||||
vector<char> vfSubscribe;
|
||||
@@ -523,12 +540,21 @@ public:
|
||||
nServices = 0;
|
||||
hSocket = hSocketIn;
|
||||
vSend.SetType(SER_NETWORK);
|
||||
vSend.SetVersion(0);
|
||||
vRecv.SetType(SER_NETWORK);
|
||||
vRecv.SetVersion(0);
|
||||
// Version 0.2 obsoletes 20 Feb 2012
|
||||
if (GetTime() > 1329696000)
|
||||
{
|
||||
vSend.SetVersion(209);
|
||||
vRecv.SetVersion(209);
|
||||
}
|
||||
nLastSend = 0;
|
||||
nLastRecv = 0;
|
||||
nLastSendEmpty = GetTime();
|
||||
nTimeConnected = GetTime();
|
||||
nPushPos = -1;
|
||||
nHeaderStart = -1;
|
||||
nMessageStart = -1;
|
||||
addr = addrIn;
|
||||
nVersion = 0;
|
||||
fClient = false; // set by version message
|
||||
@@ -541,6 +567,7 @@ public:
|
||||
hashContinue = 0;
|
||||
pindexLastGetBlocksBegin = 0;
|
||||
hashLastGetBlocksEnd = 0;
|
||||
nStartingHeight = -1;
|
||||
fGetAddr = false;
|
||||
vfSubscribe.assign(256, false);
|
||||
|
||||
@@ -550,7 +577,8 @@ public:
|
||||
CAddress addrYou = (fUseProxy ? CAddress("0.0.0.0") : addr);
|
||||
CAddress addrMe = (fUseProxy ? CAddress("0.0.0.0") : addrLocalHost);
|
||||
RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
|
||||
PushMessage("version", VERSION, nLocalServices, nTime, addrYou, addrMe, nLocalHostNonce, string(pszSubVer));
|
||||
PushMessage("version", VERSION, nLocalServices, nTime, addrYou, addrMe,
|
||||
nLocalHostNonce, string(pszSubVer), nBestHeight);
|
||||
}
|
||||
|
||||
~CNode()
|
||||
@@ -599,7 +627,7 @@ public:
|
||||
// Known checking here is only to save space from duplicates.
|
||||
// SendMessages will filter it again for knowns that were added
|
||||
// after addresses were pushed.
|
||||
if (!setAddrKnown.count(addr))
|
||||
if (addr.IsValid() && !setAddrKnown.count(addr))
|
||||
vAddrToSend.push_back(addr);
|
||||
}
|
||||
|
||||
@@ -639,10 +667,11 @@ public:
|
||||
void BeginMessage(const char* pszCommand)
|
||||
{
|
||||
cs_vSend.Enter();
|
||||
if (nPushPos != -1)
|
||||
if (nHeaderStart != -1)
|
||||
AbortMessage();
|
||||
nPushPos = vSend.size();
|
||||
nHeaderStart = vSend.size();
|
||||
vSend << CMessageHeader(pszCommand, 0);
|
||||
nMessageStart = vSend.size();
|
||||
if (fDebug)
|
||||
printf("%s ", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());
|
||||
printf("sending: %s ", pszCommand);
|
||||
@@ -650,10 +679,11 @@ public:
|
||||
|
||||
void AbortMessage()
|
||||
{
|
||||
if (nPushPos == -1)
|
||||
if (nHeaderStart == -1)
|
||||
return;
|
||||
vSend.resize(nPushPos);
|
||||
nPushPos = -1;
|
||||
vSend.resize(nHeaderStart);
|
||||
nHeaderStart = -1;
|
||||
nMessageStart = -1;
|
||||
cs_vSend.Leave();
|
||||
printf("(aborted)\n");
|
||||
}
|
||||
@@ -667,25 +697,36 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (nPushPos == -1)
|
||||
if (nHeaderStart == -1)
|
||||
return;
|
||||
|
||||
// Patch in the size
|
||||
unsigned int nSize = vSend.size() - nPushPos - sizeof(CMessageHeader);
|
||||
memcpy((char*)&vSend[nPushPos] + offsetof(CMessageHeader, nMessageSize), &nSize, sizeof(nSize));
|
||||
// Set the size
|
||||
unsigned int nSize = vSend.size() - nMessageStart;
|
||||
memcpy((char*)&vSend[nHeaderStart] + offsetof(CMessageHeader, nMessageSize), &nSize, sizeof(nSize));
|
||||
|
||||
// Set the checksum
|
||||
if (vSend.GetVersion() >= 209)
|
||||
{
|
||||
uint256 hash = Hash(vSend.begin() + nMessageStart, vSend.end());
|
||||
unsigned int nChecksum = 0;
|
||||
memcpy(&nChecksum, &hash, sizeof(nChecksum));
|
||||
assert(nMessageStart - nHeaderStart >= offsetof(CMessageHeader, nChecksum) + sizeof(nChecksum));
|
||||
memcpy((char*)&vSend[nHeaderStart] + offsetof(CMessageHeader, nChecksum), &nChecksum, sizeof(nChecksum));
|
||||
}
|
||||
|
||||
printf("(%d bytes) ", nSize);
|
||||
printf("\n");
|
||||
|
||||
nPushPos = -1;
|
||||
nHeaderStart = -1;
|
||||
nMessageStart = -1;
|
||||
cs_vSend.Leave();
|
||||
}
|
||||
|
||||
void EndMessageAbortIfEmpty()
|
||||
{
|
||||
if (nPushPos == -1)
|
||||
if (nHeaderStart == -1)
|
||||
return;
|
||||
int nSize = vSend.size() - nPushPos - sizeof(CMessageHeader);
|
||||
int nSize = vSend.size() - nMessageStart;
|
||||
if (nSize > 0)
|
||||
EndMessage();
|
||||
else
|
||||
@@ -694,9 +735,9 @@ public:
|
||||
|
||||
const char* GetMessageCommand() const
|
||||
{
|
||||
if (nPushPos == -1)
|
||||
if (nHeaderStart == -1)
|
||||
return "";
|
||||
return &vSend[nPushPos] + offsetof(CMessageHeader, pchCommand);
|
||||
return &vSend[nHeaderStart] + offsetof(CMessageHeader, pchCommand);
|
||||
}
|
||||
|
||||
|
||||
|
||||
473
rpc.cpp
473
rpc.cpp
@@ -18,6 +18,8 @@ using boost::asio::ip::tcp;
|
||||
using namespace json_spirit;
|
||||
|
||||
void ThreadRPCServer2(void* parg);
|
||||
typedef Value(*rpcfn_type)(const Array& params, bool fHelp);
|
||||
extern map<string, rpcfn_type> mapCallTable;
|
||||
|
||||
|
||||
|
||||
@@ -26,16 +28,45 @@ void ThreadRPCServer2(void* parg);
|
||||
|
||||
|
||||
///
|
||||
/// Note: I'm not finished designing this interface, it's still subject to change.
|
||||
/// Note: This interface may still be subject to change.
|
||||
///
|
||||
|
||||
|
||||
|
||||
Value stop(const Array& params)
|
||||
Value help(const Array& params, bool fHelp)
|
||||
{
|
||||
if (params.size() != 0)
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"stop (no parameters)\n"
|
||||
"help\n"
|
||||
"List commands.");
|
||||
|
||||
string strRet;
|
||||
for (map<string, rpcfn_type>::iterator mi = mapCallTable.begin(); mi != mapCallTable.end(); ++mi)
|
||||
{
|
||||
try
|
||||
{
|
||||
Array params;
|
||||
(*(*mi).second)(params, true);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
// Help text is returned in an exception
|
||||
string strHelp = string(e.what());
|
||||
if (strHelp.find('\n') != -1)
|
||||
strHelp = strHelp.substr(0, strHelp.find('\n'));
|
||||
strRet += strHelp + "\n";
|
||||
}
|
||||
}
|
||||
strRet = strRet.substr(0,strRet.size()-1);
|
||||
return strRet;
|
||||
}
|
||||
|
||||
|
||||
Value stop(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"stop\n"
|
||||
"Stop bitcoin server.");
|
||||
|
||||
// Shutdown will take long enough that the response should get back
|
||||
@@ -44,83 +75,87 @@ Value stop(const Array& params)
|
||||
}
|
||||
|
||||
|
||||
Value getblockcount(const Array& params)
|
||||
Value getblockcount(const Array& params, bool fHelp)
|
||||
{
|
||||
if (params.size() != 0)
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getblockcount (no parameters)\n"
|
||||
"getblockcount\n"
|
||||
"Returns the number of blocks in the longest block chain.");
|
||||
|
||||
return nBestHeight + 1;
|
||||
}
|
||||
|
||||
|
||||
Value getblocknumber(const Array& params)
|
||||
Value getblocknumber(const Array& params, bool fHelp)
|
||||
{
|
||||
if (params.size() != 0)
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getblocknumber (no parameters)\n"
|
||||
"getblocknumber\n"
|
||||
"Returns the block number of the latest block in the longest block chain.");
|
||||
|
||||
return nBestHeight;
|
||||
}
|
||||
|
||||
|
||||
Value getconnectioncount(const Array& params)
|
||||
Value getconnectioncount(const Array& params, bool fHelp)
|
||||
{
|
||||
if (params.size() != 0)
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getconnectioncount (no parameters)\n"
|
||||
"getconnectioncount\n"
|
||||
"Returns the number of connections to other nodes.");
|
||||
|
||||
return (int)vNodes.size();
|
||||
}
|
||||
|
||||
|
||||
Value getdifficulty(const Array& params)
|
||||
double GetDifficulty()
|
||||
{
|
||||
if (params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getdifficulty (no parameters)\n"
|
||||
"Returns the proof-of-work difficulty as a multiple of the minimum difficulty.");
|
||||
|
||||
if (pindexBest == NULL)
|
||||
throw runtime_error("block chain not loaded");
|
||||
|
||||
// Floating point number that is a multiple of the minimum difficulty,
|
||||
// minimum difficulty = 1.0.
|
||||
if (pindexBest == NULL)
|
||||
return 1.0;
|
||||
int nShift = 256 - 32 - 31; // to fit in a uint
|
||||
double dMinimum = (CBigNum().SetCompact(bnProofOfWorkLimit.GetCompact()) >> nShift).getuint();
|
||||
double dCurrently = (CBigNum().SetCompact(pindexBest->nBits) >> nShift).getuint();
|
||||
return dMinimum / dCurrently;
|
||||
}
|
||||
|
||||
|
||||
Value getbalance(const Array& params)
|
||||
Value getdifficulty(const Array& params, bool fHelp)
|
||||
{
|
||||
if (params.size() != 0)
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getbalance (no parameters)\n"
|
||||
"getdifficulty\n"
|
||||
"Returns the proof-of-work difficulty as a multiple of the minimum difficulty.");
|
||||
|
||||
return GetDifficulty();
|
||||
}
|
||||
|
||||
|
||||
Value getbalance(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getbalance\n"
|
||||
"Returns the server's available balance.");
|
||||
|
||||
return ((double)GetBalance() / (double)COIN);
|
||||
}
|
||||
|
||||
|
||||
Value getgenerate(const Array& params)
|
||||
Value getgenerate(const Array& params, bool fHelp)
|
||||
{
|
||||
if (params.size() != 0)
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getgenerate (no parameters)\n"
|
||||
"getgenerate\n"
|
||||
"Returns true or false.");
|
||||
|
||||
return (bool)fGenerateBitcoins;
|
||||
}
|
||||
|
||||
|
||||
Value setgenerate(const Array& params)
|
||||
Value setgenerate(const Array& params, bool fHelp)
|
||||
{
|
||||
if (params.size() < 1 || params.size() > 2)
|
||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"setgenerate <generate> [genproclimit]\n"
|
||||
"<generate> is true or false to turn generation on or off.\n"
|
||||
@@ -144,11 +179,11 @@ Value setgenerate(const Array& params)
|
||||
}
|
||||
|
||||
|
||||
Value getinfo(const Array& params)
|
||||
Value getinfo(const Array& params, bool fHelp)
|
||||
{
|
||||
if (params.size() != 0)
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getinfo (no parameters)");
|
||||
"getinfo");
|
||||
|
||||
Object obj;
|
||||
obj.push_back(Pair("balance", (double)GetBalance() / (double)COIN));
|
||||
@@ -157,13 +192,14 @@ Value getinfo(const Array& params)
|
||||
obj.push_back(Pair("proxy", (fUseProxy ? addrProxy.ToStringIPPort() : string())));
|
||||
obj.push_back(Pair("generate", (bool)fGenerateBitcoins));
|
||||
obj.push_back(Pair("genproclimit", (int)(fLimitProcessors ? nLimitProcessors : -1)));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
Value getnewaddress(const Array& params)
|
||||
Value getnewaddress(const Array& params, bool fHelp)
|
||||
{
|
||||
if (params.size() > 1)
|
||||
if (fHelp || params.size() > 1)
|
||||
throw runtime_error(
|
||||
"getnewaddress [label]\n"
|
||||
"Returns a new bitcoin address for receiving payments. "
|
||||
@@ -183,9 +219,76 @@ Value getnewaddress(const Array& params)
|
||||
}
|
||||
|
||||
|
||||
Value sendtoaddress(const Array& params)
|
||||
Value setlabel(const Array& params, bool fHelp)
|
||||
{
|
||||
if (params.size() < 2 || params.size() > 4)
|
||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"setlabel <bitcoinaddress> <label>\n"
|
||||
"Sets the label associated with the given address.");
|
||||
|
||||
string strAddress = params[0].get_str();
|
||||
string strLabel;
|
||||
if (params.size() > 1)
|
||||
strLabel = params[1].get_str();
|
||||
|
||||
SetAddressBookName(strAddress, strLabel);
|
||||
return Value::null;
|
||||
}
|
||||
|
||||
|
||||
Value getlabel(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error(
|
||||
"getlabel <bitcoinaddress>\n"
|
||||
"Returns the label associated with the given address.");
|
||||
|
||||
string strAddress = params[0].get_str();
|
||||
|
||||
string strLabel;
|
||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||
{
|
||||
map<string, string>::iterator mi = mapAddressBook.find(strAddress);
|
||||
if (mi != mapAddressBook.end() && !(*mi).second.empty())
|
||||
strLabel = (*mi).second;
|
||||
}
|
||||
return strLabel;
|
||||
}
|
||||
|
||||
|
||||
Value getaddressesbylabel(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error(
|
||||
"getaddressesbylabel <label>\n"
|
||||
"Returns the list of addresses with the given label.");
|
||||
|
||||
string strLabel = params[0].get_str();
|
||||
|
||||
// Find all addresses that have the given label
|
||||
Array ret;
|
||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||
{
|
||||
foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
|
||||
{
|
||||
const string& strAddress = item.first;
|
||||
const string& strName = item.second;
|
||||
if (strName == strLabel)
|
||||
{
|
||||
// We're only adding valid bitcoin addresses and not ip addresses
|
||||
CScript scriptPubKey;
|
||||
if (scriptPubKey.SetBitcoinAddress(strAddress))
|
||||
ret.push_back(strAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Value sendtoaddress(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() < 2 || params.size() > 4)
|
||||
throw runtime_error(
|
||||
"sendtoaddress <bitcoinaddress> <amount> [comment] [comment-to]\n"
|
||||
"<amount> is a real and is rounded to the nearest 0.01");
|
||||
@@ -211,9 +314,9 @@ Value sendtoaddress(const Array& params)
|
||||
}
|
||||
|
||||
|
||||
Value listtransactions(const Array& params)
|
||||
Value listtransactions(const Array& params, bool fHelp)
|
||||
{
|
||||
if (params.size() > 2)
|
||||
if (fHelp || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"listtransactions [count=10] [includegenerated=false]\n"
|
||||
"Returns up to [count] most recent transactions.");
|
||||
@@ -232,11 +335,11 @@ Value listtransactions(const Array& params)
|
||||
}
|
||||
|
||||
|
||||
Value getamountreceived(const Array& params)
|
||||
Value getreceivedbyaddress(const Array& params, bool fHelp)
|
||||
{
|
||||
if (params.size() < 1 || params.size() > 2)
|
||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"getamountreceived <bitcoinaddress> [minconf=1]\n"
|
||||
"getreceivedbyaddress <bitcoinaddress> [minconf=1]\n"
|
||||
"Returns the total amount received by <bitcoinaddress> in transactions with at least [minconf] confirmations.");
|
||||
|
||||
// Bitcoin address
|
||||
@@ -244,6 +347,8 @@ Value getamountreceived(const Array& params)
|
||||
CScript scriptPubKey;
|
||||
if (!scriptPubKey.SetBitcoinAddress(strAddress))
|
||||
throw runtime_error("Invalid bitcoin address");
|
||||
if (!IsMine(scriptPubKey))
|
||||
return (double)0.0;
|
||||
|
||||
// Minimum confirmations
|
||||
int nMinDepth = 1;
|
||||
@@ -271,6 +376,59 @@ Value getamountreceived(const Array& params)
|
||||
}
|
||||
|
||||
|
||||
Value getreceivedbylabel(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"getreceivedbylabel <label> [minconf=1]\n"
|
||||
"Returns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations.");
|
||||
|
||||
// Get the set of pub keys that have the label
|
||||
string strLabel = params[0].get_str();
|
||||
set<CScript> setPubKey;
|
||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||
{
|
||||
foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
|
||||
{
|
||||
const string& strAddress = item.first;
|
||||
const string& strName = item.second;
|
||||
if (strName == strLabel)
|
||||
{
|
||||
// We're only counting our own valid bitcoin addresses and not ip addresses
|
||||
CScript scriptPubKey;
|
||||
if (scriptPubKey.SetBitcoinAddress(strAddress))
|
||||
if (IsMine(scriptPubKey))
|
||||
setPubKey.insert(scriptPubKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Minimum confirmations
|
||||
int nMinDepth = 1;
|
||||
if (params.size() > 1)
|
||||
nMinDepth = params[1].get_int();
|
||||
|
||||
// Tally
|
||||
int64 nAmount = 0;
|
||||
CRITICAL_BLOCK(cs_mapWallet)
|
||||
{
|
||||
for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
|
||||
{
|
||||
const CWalletTx& wtx = (*it).second;
|
||||
if (wtx.IsCoinBase() || !wtx.IsFinal())
|
||||
continue;
|
||||
|
||||
foreach(const CTxOut& txout, wtx.vout)
|
||||
if (setPubKey.count(txout.scriptPubKey))
|
||||
if (wtx.GetDepthInMainChain() >= nMinDepth)
|
||||
nAmount += txout.nValue;
|
||||
}
|
||||
}
|
||||
|
||||
return (double)nAmount / (double)COIN;
|
||||
}
|
||||
|
||||
|
||||
struct tallyitem
|
||||
{
|
||||
int64 nAmount;
|
||||
@@ -282,23 +440,18 @@ struct tallyitem
|
||||
}
|
||||
};
|
||||
|
||||
Value getallreceived(const Array& params)
|
||||
Value ListReceived(const Array& params, bool fByLabels)
|
||||
{
|
||||
if (params.size() > 1)
|
||||
throw runtime_error(
|
||||
"getallreceived [minconf=1]\n"
|
||||
"[minconf] is the minimum number of confirmations before payments are included.\n"
|
||||
"Returns an array of objects containing:\n"
|
||||
" \"address\" : receiving address\n"
|
||||
" \"amount\" : total amount received by the address\n"
|
||||
" \"confirmations\" : number of confirmations of the most recent transaction included\n"
|
||||
" \"label\" : the label of the receiving address");
|
||||
|
||||
// Minimum confirmations
|
||||
int nMinDepth = 1;
|
||||
if (params.size() > 0)
|
||||
nMinDepth = params[0].get_int();
|
||||
|
||||
// Whether to include empty accounts
|
||||
bool fIncludeEmpty = false;
|
||||
if (params.size() > 1)
|
||||
fIncludeEmpty = params[1].get_bool();
|
||||
|
||||
// Tally
|
||||
map<uint160, tallyitem> mapTally;
|
||||
CRITICAL_BLOCK(cs_mapWallet)
|
||||
@@ -313,18 +466,11 @@ Value getallreceived(const Array& params)
|
||||
if (nDepth < nMinDepth)
|
||||
continue;
|
||||
|
||||
// Filter out debits and payments to self, which may have change return
|
||||
// we don't want to count.
|
||||
int64 nCredit = wtx.GetCredit(true);
|
||||
int64 nDebit = wtx.GetDebit();
|
||||
int64 nNet = nCredit - nDebit;
|
||||
if (nNet <= 0)
|
||||
continue;
|
||||
|
||||
foreach(const CTxOut& txout, wtx.vout)
|
||||
{
|
||||
// Only counting our own bitcoin addresses and not ip addresses
|
||||
uint160 hash160 = txout.scriptPubKey.GetBitcoinAddressHash160();
|
||||
if (hash160 == 0 || !mapPubKeys.count(hash160))
|
||||
if (hash160 == 0 || !mapPubKeys.count(hash160)) // IsMine
|
||||
continue;
|
||||
|
||||
tallyitem& item = mapTally[hash160];
|
||||
@@ -336,27 +482,100 @@ Value getallreceived(const Array& params)
|
||||
|
||||
// Reply
|
||||
Array ret;
|
||||
map<string, tallyitem> mapLabelTally;
|
||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||
{
|
||||
for (map<uint160, tallyitem>::iterator it = mapTally.begin(); it != mapTally.end(); ++it)
|
||||
foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
|
||||
{
|
||||
string strAddress = Hash160ToAddress((*it).first);
|
||||
string strLabel;
|
||||
map<string, string>::iterator mi = mapAddressBook.find(strAddress);
|
||||
if (mi != mapAddressBook.end())
|
||||
strLabel = (*mi).second;
|
||||
const string& strAddress = item.first;
|
||||
const string& strLabel = item.second;
|
||||
uint160 hash160;
|
||||
if (!AddressToHash160(strAddress, hash160))
|
||||
continue;
|
||||
map<uint160, tallyitem>::iterator it = mapTally.find(hash160);
|
||||
if (it == mapTally.end() && !fIncludeEmpty)
|
||||
continue;
|
||||
|
||||
int64 nAmount = 0;
|
||||
int nConf = INT_MAX;
|
||||
if (it != mapTally.end())
|
||||
{
|
||||
nAmount = (*it).second.nAmount;
|
||||
nConf = (*it).second.nConf;
|
||||
}
|
||||
|
||||
if (fByLabels)
|
||||
{
|
||||
tallyitem& item = mapLabelTally[strLabel];
|
||||
item.nAmount += nAmount;
|
||||
item.nConf = min(item.nConf, nConf);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object obj;
|
||||
obj.push_back(Pair("address", strAddress));
|
||||
obj.push_back(Pair("label", strLabel));
|
||||
obj.push_back(Pair("amount", (double)nAmount / (double)COIN));
|
||||
obj.push_back(Pair("confirmations", (nConf == INT_MAX ? 0 : nConf)));
|
||||
ret.push_back(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fByLabels)
|
||||
{
|
||||
for (map<string, tallyitem>::iterator it = mapLabelTally.begin(); it != mapLabelTally.end(); ++it)
|
||||
{
|
||||
int64 nAmount = (*it).second.nAmount;
|
||||
int nConf = (*it).second.nConf;
|
||||
Object obj;
|
||||
obj.push_back(Pair("address", strAddress));
|
||||
obj.push_back(Pair("amount", (double)(*it).second.nAmount / (double)COIN));
|
||||
obj.push_back(Pair("confirmations", (*it).second.nConf));
|
||||
obj.push_back(Pair("label", strLabel));
|
||||
obj.push_back(Pair("label", (*it).first));
|
||||
obj.push_back(Pair("amount", (double)nAmount / (double)COIN));
|
||||
obj.push_back(Pair("confirmations", (nConf == INT_MAX ? 0 : nConf)));
|
||||
ret.push_back(obj);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Value listreceivedbyaddress(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"listreceivedbyaddress [minconf=1] [includeempty=false]\n"
|
||||
"[minconf] is the minimum number of confirmations before payments are included.\n"
|
||||
"[includeempty] whether to include addresses that haven't received any payments.\n"
|
||||
"Returns an array of objects containing:\n"
|
||||
" \"address\" : receiving address\n"
|
||||
" \"label\" : the label of the receiving address\n"
|
||||
" \"amount\" : total amount received by the address\n"
|
||||
" \"confirmations\" : number of confirmations of the most recent transaction included");
|
||||
|
||||
return ListReceived(params, false);
|
||||
}
|
||||
|
||||
Value listreceivedbylabel(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"listreceivedbylabel [minconf=1] [includeempty=false]\n"
|
||||
"[minconf] is the minimum number of confirmations before payments are included.\n"
|
||||
"[includeempty] whether to include labels that haven't received any payments.\n"
|
||||
"Returns an array of objects containing:\n"
|
||||
" \"label\" : the label of the receiving addresses\n"
|
||||
" \"amount\" : total amount received by addresses with this label\n"
|
||||
" \"confirmations\" : number of confirmations of the most recent transaction included");
|
||||
|
||||
return ListReceived(params, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -367,23 +586,30 @@ Value getallreceived(const Array& params)
|
||||
// Call Table
|
||||
//
|
||||
|
||||
typedef Value(*rpcfn_type)(const Array& params);
|
||||
pair<string, rpcfn_type> pCallTable[] =
|
||||
{
|
||||
make_pair("stop", &stop),
|
||||
make_pair("getblockcount", &getblockcount),
|
||||
make_pair("getblocknumber", &getblocknumber),
|
||||
make_pair("getconnectioncount", &getconnectioncount),
|
||||
make_pair("getdifficulty", &getdifficulty),
|
||||
make_pair("getbalance", &getbalance),
|
||||
make_pair("getgenerate", &getgenerate),
|
||||
make_pair("setgenerate", &setgenerate),
|
||||
make_pair("getinfo", &getinfo),
|
||||
make_pair("getnewaddress", &getnewaddress),
|
||||
make_pair("sendtoaddress", &sendtoaddress),
|
||||
make_pair("listtransactions", &listtransactions),
|
||||
make_pair("getamountreceived", &getamountreceived),
|
||||
make_pair("getallreceived", &getallreceived),
|
||||
make_pair("help", &help),
|
||||
make_pair("stop", &stop),
|
||||
make_pair("getblockcount", &getblockcount),
|
||||
make_pair("getblocknumber", &getblocknumber),
|
||||
make_pair("getconnectioncount", &getconnectioncount),
|
||||
make_pair("getdifficulty", &getdifficulty),
|
||||
make_pair("getbalance", &getbalance),
|
||||
make_pair("getgenerate", &getgenerate),
|
||||
make_pair("setgenerate", &setgenerate),
|
||||
make_pair("getinfo", &getinfo),
|
||||
make_pair("getnewaddress", &getnewaddress),
|
||||
make_pair("setlabel", &setlabel),
|
||||
make_pair("getlabel", &getlabel),
|
||||
make_pair("getaddressesbylabel", &getaddressesbylabel),
|
||||
make_pair("sendtoaddress", &sendtoaddress),
|
||||
make_pair("listtransactions", &listtransactions),
|
||||
make_pair("getamountreceived", &getreceivedbyaddress), // deprecated, renamed to getreceivedbyaddress
|
||||
make_pair("getallreceived", &listreceivedbyaddress), // deprecated, renamed to listreceivedbyaddress
|
||||
make_pair("getreceivedbyaddress", &getreceivedbyaddress),
|
||||
make_pair("getreceivedbylabel", &getreceivedbylabel),
|
||||
make_pair("listreceivedbyaddress", &listreceivedbyaddress),
|
||||
make_pair("listreceivedbylabel", &listreceivedbylabel),
|
||||
};
|
||||
map<string, rpcfn_type> mapCallTable(pCallTable, pCallTable + sizeof(pCallTable)/sizeof(pCallTable[0]));
|
||||
|
||||
@@ -565,7 +791,7 @@ void ThreadRPCServer2(void* parg)
|
||||
map<string, rpcfn_type>::iterator mi = mapCallTable.find(strMethod);
|
||||
if (mi == mapCallTable.end())
|
||||
throw runtime_error("Method not found.");
|
||||
Value result = (*(*mi).second)(params);
|
||||
Value result = (*(*mi).second)(params, false);
|
||||
|
||||
// Send reply
|
||||
string strReply = JSONRPCReply(result, Value::null, id);
|
||||
@@ -652,42 +878,67 @@ int CommandLineRPC(int argc, char *argv[])
|
||||
if (!mapCallTable.count(strMethod))
|
||||
throw runtime_error(strprintf("unknown command: %s", strMethod.c_str()));
|
||||
|
||||
// Parameters default to strings
|
||||
Array params;
|
||||
for (int i = 2; i < argc; i++)
|
||||
params.push_back(argv[i]);
|
||||
int n = params.size();
|
||||
Value result;
|
||||
if (argc == 3 && strcmp(argv[2], "-?") == 0)
|
||||
{
|
||||
// Call help locally, help text is returned in an exception
|
||||
try
|
||||
{
|
||||
map<string, rpcfn_type>::iterator mi = mapCallTable.find(strMethod);
|
||||
Array params;
|
||||
(*(*mi).second)(params, true);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
result = e.what();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parameters default to strings
|
||||
Array params;
|
||||
for (int i = 2; i < argc; i++)
|
||||
params.push_back(argv[i]);
|
||||
int n = params.size();
|
||||
|
||||
//
|
||||
// Special case other types
|
||||
//
|
||||
if (strMethod == "setgenerate" && n > 0) ConvertTo<bool>(params[0]);
|
||||
if (strMethod == "setgenerate" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
||||
if (strMethod == "sendtoaddress" && n > 1) ConvertTo<double>(params[1]);
|
||||
if (strMethod == "listtransactions" && n > 0) ConvertTo<boost::int64_t>(params[0]);
|
||||
if (strMethod == "listtransactions" && n > 1) ConvertTo<bool>(params[1]);
|
||||
if (strMethod == "getamountreceived" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
||||
if (strMethod == "getallreceived" && n > 0) ConvertTo<boost::int64_t>(params[0]);
|
||||
//
|
||||
// Special case non-string parameter types
|
||||
//
|
||||
if (strMethod == "setgenerate" && n > 0) ConvertTo<bool>(params[0]);
|
||||
if (strMethod == "setgenerate" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
||||
if (strMethod == "sendtoaddress" && n > 1) ConvertTo<double>(params[1]);
|
||||
if (strMethod == "listtransactions" && n > 0) ConvertTo<boost::int64_t>(params[0]);
|
||||
if (strMethod == "listtransactions" && n > 1) ConvertTo<bool>(params[1]);
|
||||
if (strMethod == "getamountreceived" && n > 1) ConvertTo<boost::int64_t>(params[1]); // deprecated
|
||||
if (strMethod == "getreceivedbyaddress" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
||||
if (strMethod == "getreceivedbylabel" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
||||
if (strMethod == "getallreceived" && n > 0) ConvertTo<boost::int64_t>(params[0]); // deprecated
|
||||
if (strMethod == "getallreceived" && n > 1) ConvertTo<bool>(params[1]);
|
||||
if (strMethod == "listreceivedbyaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]);
|
||||
if (strMethod == "listreceivedbyaddress" && n > 1) ConvertTo<bool>(params[1]);
|
||||
if (strMethod == "listreceivedbylabel" && n > 0) ConvertTo<boost::int64_t>(params[0]);
|
||||
if (strMethod == "listreceivedbylabel" && n > 1) ConvertTo<bool>(params[1]);
|
||||
|
||||
// Execute
|
||||
Value result = CallRPC(strMethod, params);
|
||||
// Execute
|
||||
result = CallRPC(strMethod, params);
|
||||
}
|
||||
|
||||
// Print result
|
||||
string strResult = (result.type() == str_type ? result.get_str() : write_string(result, true));
|
||||
if (result.type() != null_type)
|
||||
{
|
||||
if (fWindows)
|
||||
if (fWindows && fGUI)
|
||||
// Windows GUI apps can't print to command line,
|
||||
// so for now settle for a message box yuck
|
||||
wxMessageBox(strResult.c_str(), "Bitcoin", wxOK);
|
||||
// so settle for a message box yuck
|
||||
MyMessageBox(strResult.c_str(), "Bitcoin", wxOK);
|
||||
else
|
||||
fprintf(stdout, "%s\n", strResult.c_str());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
if (fWindows)
|
||||
wxMessageBox(strprintf("error: %s\n", e.what()).c_str(), "Bitcoin", wxOK);
|
||||
if (fWindows && fGUI)
|
||||
MyMessageBox(strprintf("error: %s\n", e.what()).c_str(), "Bitcoin", wxOK);
|
||||
else
|
||||
fprintf(stderr, "error: %s\n", e.what());
|
||||
} catch (...) {
|
||||
|
||||
14
serialize.h
14
serialize.h
@@ -19,7 +19,7 @@ class CScript;
|
||||
class CDataStream;
|
||||
class CAutoFile;
|
||||
|
||||
static const int VERSION = 206;
|
||||
static const int VERSION = 211;
|
||||
static const char* pszSubVer = ".0";
|
||||
|
||||
|
||||
@@ -809,6 +809,18 @@ public:
|
||||
vch.insert(it, first, last);
|
||||
}
|
||||
|
||||
void insert(iterator it, vector<char>::const_iterator first, vector<char>::const_iterator last)
|
||||
{
|
||||
if (it == vch.begin() + nReadPos && last - first <= nReadPos)
|
||||
{
|
||||
// special case for inserting at the front when there's room
|
||||
nReadPos -= (last - first);
|
||||
memcpy(&vch[nReadPos], &first[0], last - first);
|
||||
}
|
||||
else
|
||||
vch.insert(it, first, last);
|
||||
}
|
||||
|
||||
#if !defined(_MSC_VER) || _MSC_VER >= 1300
|
||||
void insert(iterator it, const char* first, const char* last)
|
||||
{
|
||||
|
||||
704
ui.cpp
704
ui.cpp
@@ -7,38 +7,18 @@
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
bool GetStartOnSystemStartup();
|
||||
void SetStartOnSystemStartup(bool fAutoStart);
|
||||
|
||||
|
||||
|
||||
DEFINE_EVENT_TYPE(wxEVT_UITHREADCALL)
|
||||
|
||||
CMainFrame* pframeMain = NULL;
|
||||
CMyTaskBarIcon* ptaskbaricon = NULL;
|
||||
extern int g_isPainting;
|
||||
bool fClosedToTray = false;
|
||||
|
||||
// Settings
|
||||
int fMinimizeToTray = true;
|
||||
int fMinimizeOnClose = true;
|
||||
|
||||
|
||||
|
||||
|
||||
int MyMessageBox(const wxString& message, const wxString& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1)
|
||||
{
|
||||
if (fDaemon)
|
||||
{
|
||||
printf("wxMessageBox %s: %s\n", string(caption).c_str(), string(message).c_str());
|
||||
fprintf(stderr, "%s: %s\n", string(caption).c_str(), string(message).c_str());
|
||||
return wxOK;
|
||||
}
|
||||
return wxMessageBox(message, caption, style, parent, x, y);
|
||||
}
|
||||
#define wxMessageBox MyMessageBox
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -48,47 +28,6 @@ int MyMessageBox(const wxString& message, const wxString& caption="Message", int
|
||||
// Util
|
||||
//
|
||||
|
||||
void ExitTimeout(void* parg)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
Sleep(5000);
|
||||
ExitProcess(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Shutdown(void* parg)
|
||||
{
|
||||
static CCriticalSection cs_Shutdown;
|
||||
static bool fTaken;
|
||||
bool fFirstThread;
|
||||
CRITICAL_BLOCK(cs_Shutdown)
|
||||
{
|
||||
fFirstThread = !fTaken;
|
||||
fTaken = true;
|
||||
}
|
||||
static bool fExit;
|
||||
if (fFirstThread)
|
||||
{
|
||||
fShutdown = true;
|
||||
nTransactionsUpdated++;
|
||||
DBFlush(false);
|
||||
StopNode();
|
||||
DBFlush(true);
|
||||
CreateThread(ExitTimeout, NULL);
|
||||
Sleep(50);
|
||||
printf("Bitcoin exiting\n\n");
|
||||
fExit = true;
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (!fExit)
|
||||
Sleep(500);
|
||||
Sleep(100);
|
||||
ExitThread(0);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleCtrlA(wxKeyEvent& event)
|
||||
{
|
||||
// Ctrl-a select all
|
||||
@@ -254,6 +193,12 @@ bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* pa
|
||||
return (ThreadSafeMessageBox(strMessage, strCaption, wxYES_NO, parent) == wxYES);
|
||||
}
|
||||
|
||||
void CalledSetStatusBar(const string& strText, int nField)
|
||||
{
|
||||
if (pframeMain && pframeMain->m_statusBar)
|
||||
pframeMain->m_statusBar->SetStatusText(strText, nField);
|
||||
}
|
||||
|
||||
void SetDefaultReceivingAddress(const string& strAddress)
|
||||
{
|
||||
// Update main window address and database
|
||||
@@ -312,16 +257,26 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent)
|
||||
m_staticTextBalance->SetSize(140, 17);
|
||||
// resize to fit ubuntu's huge default font
|
||||
dResize = 1.22;
|
||||
SetSize(dResize * GetSize().GetWidth(), 1.09 * GetSize().GetHeight());
|
||||
SetSize(dResize * GetSize().GetWidth(), 1.15 * GetSize().GetHeight());
|
||||
#endif
|
||||
m_staticTextBalance->SetLabel(FormatMoney(GetBalance()) + " ");
|
||||
m_listCtrl->SetFocus();
|
||||
ptaskbaricon = new CMyTaskBarIcon();
|
||||
#ifdef __WXMAC__
|
||||
// Mac automatically moves wxID_EXIT, wxID_PREFERENCES and wxID_ABOUT
|
||||
// to their standard places, leaving these menus empty.
|
||||
GetMenuBar()->Remove(2); // remove Help menu
|
||||
GetMenuBar()->Remove(0); // remove File menu
|
||||
#endif
|
||||
|
||||
// Init column headers
|
||||
int nDateWidth = DateTimeStr(1229413914).size() * 6 + 8;
|
||||
if (!strstr(DateTimeStr(1229413914).c_str(), "2008"))
|
||||
nDateWidth += 12;
|
||||
#ifdef __WXMAC__
|
||||
nDateWidth += 5;
|
||||
dResize -= 0.01;
|
||||
#endif
|
||||
wxListCtrl* pplistCtrl[] = {m_listCtrlAll, m_listCtrlSentReceived, m_listCtrlSent, m_listCtrlReceived};
|
||||
foreach(wxListCtrl* p, pplistCtrl)
|
||||
{
|
||||
@@ -335,7 +290,7 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent)
|
||||
}
|
||||
|
||||
// Init status bar
|
||||
int pnWidths[3] = { -100, 88, 290 };
|
||||
int pnWidths[3] = { -100, 88, 300 };
|
||||
#ifndef __WXMSW__
|
||||
pnWidths[1] = pnWidths[1] * 1.1 * dResize;
|
||||
pnWidths[2] = pnWidths[2] * 1.1 * dResize;
|
||||
@@ -1061,6 +1016,11 @@ void CMainFrame::OnPaintListCtrl(wxPaintEvent& event)
|
||||
|
||||
if (fDebug && GetTime() - nThreadSocketHandlerHeartbeat > 60)
|
||||
m_statusBar->SetStatusText(" ERROR: ThreadSocketHandler has stopped", 0);
|
||||
|
||||
// Update receiving address
|
||||
string strDefaultAddress = PubKeyToAddress(vchDefaultKey);
|
||||
if (m_textCtrlAddress->GetValue() != strDefaultAddress)
|
||||
m_textCtrlAddress->SetValue(strDefaultAddress);
|
||||
}
|
||||
|
||||
|
||||
@@ -1630,7 +1590,6 @@ void COptionsDialog::OnButtonApply(wxCommandEvent& event)
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CAboutDialog
|
||||
@@ -2014,7 +1973,7 @@ void CSendingDialog::StartTransfer()
|
||||
// Make sure we have enough money
|
||||
if (nPrice + nTransactionFee > GetBalance())
|
||||
{
|
||||
Error(_("You don't have enough money"));
|
||||
Error(_("Insufficient funds"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2081,7 +2040,7 @@ void CSendingDialog::OnReply2(CDataStream& vRecv)
|
||||
return;
|
||||
if (nPrice + nTransactionFee > GetBalance())
|
||||
{
|
||||
Error(_("You don't have enough money"));
|
||||
Error(_("Insufficient funds"));
|
||||
return;
|
||||
}
|
||||
CKey key;
|
||||
@@ -2133,7 +2092,9 @@ void CSendingDialog::OnReply2(CDataStream& vRecv)
|
||||
}
|
||||
|
||||
// Send payment tx to seller, with response going to OnReply3 via event handler
|
||||
pnode->PushRequest("submitorder", wtx, SendingDialogOnReply3, this);
|
||||
CWalletTx wtxSend = wtx;
|
||||
wtxSend.fFromMe = false;
|
||||
pnode->PushRequest("submitorder", wtxSend, SendingDialogOnReply3, this);
|
||||
|
||||
Status(_("Waiting for confirmation..."));
|
||||
MainFrameRepaint();
|
||||
@@ -2219,7 +2180,7 @@ CAddressBookDialog::CAddressBookDialog(wxWindow* parent, const wxString& strInit
|
||||
bool fMine = (AddressToHash160(strAddress, hash160) && mapPubKeys.count(hash160));
|
||||
wxListCtrl* plistCtrl = fMine ? m_listCtrlReceiving : m_listCtrlSending;
|
||||
int nIndex = InsertLine(plistCtrl, strName, strAddress);
|
||||
if (strAddress == (fMine ? strDefaultReceiving : strInitSelected))
|
||||
if (strAddress == (fMine ? strDefaultReceiving : string(strInitSelected)))
|
||||
plistCtrl->SetItemState(nIndex, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
|
||||
}
|
||||
}
|
||||
@@ -2506,7 +2467,7 @@ void CMyTaskBarIcon::OnMenuRestore(wxCommandEvent& event)
|
||||
void CMyTaskBarIcon::OnMenuOptions(wxCommandEvent& event)
|
||||
{
|
||||
// Since it's modal, get the main window to do it
|
||||
wxCommandEvent event2(wxEVT_COMMAND_MENU_SELECTED, wxID_MENUOPTIONSOPTIONS);
|
||||
wxCommandEvent event2(wxEVT_COMMAND_MENU_SELECTED, wxID_PREFERENCES);
|
||||
pframeMain->GetEventHandler()->AddPendingEvent(event2);
|
||||
}
|
||||
|
||||
@@ -2562,607 +2523,26 @@ wxMenu* CMyTaskBarIcon::CreatePopupMenu()
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMyApp
|
||||
//
|
||||
|
||||
// Define a new application
|
||||
class CMyApp: public wxApp
|
||||
|
||||
|
||||
void CreateMainWindow()
|
||||
{
|
||||
public:
|
||||
wxLocale m_locale;
|
||||
|
||||
CMyApp(){};
|
||||
~CMyApp(){};
|
||||
bool OnInit();
|
||||
bool OnInit2();
|
||||
int OnExit();
|
||||
|
||||
// Hook Initialize so we can start without GUI
|
||||
virtual bool Initialize(int& argc, wxChar** argv);
|
||||
|
||||
// 2nd-level exception handling: we get all the exceptions occurring in any
|
||||
// event handler here
|
||||
virtual bool OnExceptionInMainLoop();
|
||||
|
||||
// 3rd, and final, level exception handling: whenever an unhandled
|
||||
// exception is caught, this function is called
|
||||
virtual void OnUnhandledException();
|
||||
|
||||
// and now for something different: this function is called in case of a
|
||||
// crash (e.g. dereferencing null pointer, division by 0, ...)
|
||||
virtual void OnFatalException();
|
||||
};
|
||||
|
||||
IMPLEMENT_APP(CMyApp)
|
||||
|
||||
bool CMyApp::Initialize(int& argc, wxChar** argv)
|
||||
{
|
||||
if (argc > 1 && argv[1][0] != '-' && (!fWindows || argv[1][0] != '/') &&
|
||||
wxString(argv[1]) != "start")
|
||||
{
|
||||
fCommandLine = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// wxApp::Initialize will remove environment-specific parameters,
|
||||
// so it's too early to call ParseParameters yet
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
wxString str = argv[i];
|
||||
#ifdef __WXMSW__
|
||||
if (str.size() >= 1 && str[0] == '/')
|
||||
str[0] = '-';
|
||||
str = str.MakeLower();
|
||||
#endif
|
||||
// haven't decided which argument to use for this yet
|
||||
if (str == "-daemon" || str == "-d" || str == "start")
|
||||
fDaemon = true;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __WXGTK__
|
||||
if (fDaemon || fCommandLine)
|
||||
{
|
||||
// Call the original Initialize while suppressing error messages
|
||||
// and ignoring failure. If unable to initialize GTK, it fails
|
||||
// near the end so hopefully the last few things don't matter.
|
||||
{
|
||||
wxLogNull logNo;
|
||||
wxApp::Initialize(argc, argv);
|
||||
}
|
||||
|
||||
if (fDaemon)
|
||||
{
|
||||
fprintf(stdout, "bitcoin server starting\n");
|
||||
|
||||
// Daemonize
|
||||
pid_t pid = fork();
|
||||
if (pid < 0)
|
||||
{
|
||||
fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
|
||||
return false;
|
||||
}
|
||||
if (pid > 0)
|
||||
pthread_exit((void*)0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return wxApp::Initialize(argc, argv);
|
||||
}
|
||||
|
||||
bool CMyApp::OnInit()
|
||||
{
|
||||
bool fRet = false;
|
||||
try
|
||||
{
|
||||
fRet = OnInit2();
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
PrintException(&e, "OnInit()");
|
||||
} catch (...) {
|
||||
PrintException(NULL, "OnInit()");
|
||||
}
|
||||
if (!fRet)
|
||||
Shutdown(NULL);
|
||||
return fRet;
|
||||
}
|
||||
|
||||
bool CMyApp::OnInit2()
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
// Turn off microsoft heap dump noise
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_WARN, CreateFileA("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0));
|
||||
#endif
|
||||
#if defined(__WXMSW__) && defined(__WXDEBUG__)
|
||||
// Disable malfunctioning wxWidgets debug assertion
|
||||
g_isPainting = 10000;
|
||||
#endif
|
||||
wxImage::AddHandler(new wxPNGHandler);
|
||||
#ifdef __WXMSW__
|
||||
SetAppName("Bitcoin");
|
||||
#else
|
||||
SetAppName("bitcoin");
|
||||
umask(077);
|
||||
#endif
|
||||
#ifdef __WXMSW__
|
||||
#if wxUSE_UNICODE
|
||||
// Hack to set wxConvLibc codepage to UTF-8 on Windows,
|
||||
// may break if wxMBConv_win32 implementation in strconv.cpp changes.
|
||||
class wxMBConv_win32 : public wxMBConv
|
||||
{
|
||||
public:
|
||||
long m_CodePage;
|
||||
size_t m_minMBCharWidth;
|
||||
};
|
||||
if (((wxMBConv_win32*)&wxConvLibc)->m_CodePage == CP_ACP)
|
||||
((wxMBConv_win32*)&wxConvLibc)->m_CodePage = CP_UTF8;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Load locale/<lang>/LC_MESSAGES/bitcoin.mo language file
|
||||
m_locale.Init(wxLANGUAGE_DEFAULT, 0);
|
||||
m_locale.AddCatalogLookupPathPrefix("locale");
|
||||
if (!fWindows)
|
||||
{
|
||||
m_locale.AddCatalogLookupPathPrefix("/usr/share/locale");
|
||||
m_locale.AddCatalogLookupPathPrefix("/usr/local/share/locale");
|
||||
}
|
||||
m_locale.AddCatalog("wxstd"); // wxWidgets standard translations, if any
|
||||
m_locale.AddCatalog("bitcoin");
|
||||
|
||||
//
|
||||
// Parameters
|
||||
//
|
||||
if (fCommandLine)
|
||||
{
|
||||
int ret = CommandLineRPC(argc, argv);
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
ParseParameters(argc, argv);
|
||||
if (mapArgs.count("-?") || mapArgs.count("--help"))
|
||||
{
|
||||
wxString strUsage = string() +
|
||||
_("Usage: bitcoin [options]") + "\t\t\t\t\t\t\n" +
|
||||
_("Options:\n") +
|
||||
" -gen \t\t " + _("Generate coins\n") +
|
||||
" -gen=0 \t\t " + _("Don't generate coins\n") +
|
||||
" -min \t\t " + _("Start minimized\n") +
|
||||
" -datadir=<dir> \t " + _("Specify data directory\n") +
|
||||
" -proxy=<ip:port>\t " + _("Connect through socks4 proxy\n") +
|
||||
" -addnode=<ip> \t " + _("Add a node to connect to\n") +
|
||||
" -connect=<ip> \t " + _("Connect only to the specified node\n") +
|
||||
" -? \t\t " + _("This help message\n");
|
||||
|
||||
if (fWindows)
|
||||
{
|
||||
// Remove spaces, the tabs make the columns line up in the message box
|
||||
for (int i = 0; i < 50; i++)
|
||||
strUsage.Replace(" \t", "\t");
|
||||
wxMessageBox(strUsage, "Bitcoin", wxOK);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove tabs
|
||||
strUsage.Replace("\t", "");
|
||||
fprintf(stderr, "%s", ((string)strUsage).c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mapArgs.count("-datadir"))
|
||||
strlcpy(pszSetDataDir, mapArgs["-datadir"].c_str(), sizeof(pszSetDataDir));
|
||||
|
||||
if (mapArgs.count("-debug"))
|
||||
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 0.%d.%d%s beta, OS version %s\n", VERSION/100, VERSION%100, pszSubVer, ((string)wxGetOsDescription()).c_str());
|
||||
printf("System default language is %d %s\n", m_locale.GetSystemLanguage(), ((string)m_locale.GetSysName()).c_str());
|
||||
printf("Language file %s (%s)\n", (string("locale/") + (string)m_locale.GetCanonicalName() + "/LC_MESSAGES/bitcoin.mo").c_str(), ((string)m_locale.GetLocale()).c_str());
|
||||
|
||||
if (mapArgs.count("-loadblockindextest"))
|
||||
{
|
||||
CTxDB txdb("r");
|
||||
txdb.LoadBlockIndex();
|
||||
PrintBlockTree();
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Limit to single instance per user
|
||||
// Required to protect the database files if we're going to keep deleting log.*
|
||||
//
|
||||
#ifdef __WXMSW__
|
||||
// todo: wxSingleInstanceChecker wasn't working on Linux, never deleted its lock file
|
||||
// maybe should go by whether successfully bind port 8333 instead
|
||||
wxString strMutexName = wxString("bitcoin_running.") + getenv("HOMEPATH");
|
||||
for (int i = 0; i < strMutexName.size(); i++)
|
||||
if (!isalnum(strMutexName[i]))
|
||||
strMutexName[i] = '.';
|
||||
wxSingleInstanceChecker* psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
|
||||
if (psingleinstancechecker->IsAnotherRunning())
|
||||
{
|
||||
printf("Existing instance found\n");
|
||||
unsigned int nStart = GetTime();
|
||||
loop
|
||||
{
|
||||
// TODO: find out how to do this in Linux, or replace with wxWidgets commands
|
||||
// Show the previous instance and exit
|
||||
HWND hwndPrev = FindWindowA("wxWindowClassNR", "Bitcoin");
|
||||
if (hwndPrev)
|
||||
{
|
||||
if (IsIconic(hwndPrev))
|
||||
ShowWindow(hwndPrev, SW_RESTORE);
|
||||
SetForegroundWindow(hwndPrev);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetTime() > nStart + 60)
|
||||
return false;
|
||||
|
||||
// Resume this instance if the other exits
|
||||
delete psingleinstancechecker;
|
||||
Sleep(1000);
|
||||
psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
|
||||
if (!psingleinstancechecker->IsAnotherRunning())
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Bind to the port early so we can tell if another instance is already running.
|
||||
// This is a backup to wxSingleInstanceChecker, which doesn't work on Linux.
|
||||
string strErrors;
|
||||
if (!BindListenPort(strErrors))
|
||||
{
|
||||
wxMessageBox(strErrors, "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Load data files
|
||||
//
|
||||
bool fFirstRun;
|
||||
strErrors = "";
|
||||
int64 nStart;
|
||||
|
||||
printf("Loading addresses...\n");
|
||||
nStart = GetTimeMillis();
|
||||
if (!LoadAddresses())
|
||||
strErrors += _("Error loading addr.dat \n");
|
||||
printf(" addresses %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
|
||||
printf("Loading block index...\n");
|
||||
nStart = GetTimeMillis();
|
||||
if (!LoadBlockIndex())
|
||||
strErrors += _("Error loading blkindex.dat \n");
|
||||
printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
|
||||
printf("Loading wallet...\n");
|
||||
nStart = GetTimeMillis();
|
||||
if (!LoadWallet(fFirstRun))
|
||||
strErrors += _("Error loading wallet.dat \n");
|
||||
printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
|
||||
printf("Done loading\n");
|
||||
|
||||
//// debug print
|
||||
printf("mapBlockIndex.size() = %d\n", mapBlockIndex.size());
|
||||
printf("nBestHeight = %d\n", nBestHeight);
|
||||
printf("mapKeys.size() = %d\n", mapKeys.size());
|
||||
printf("mapPubKeys.size() = %d\n", mapPubKeys.size());
|
||||
printf("mapWallet.size() = %d\n", mapWallet.size());
|
||||
printf("mapAddressBook.size() = %d\n", mapAddressBook.size());
|
||||
|
||||
if (!strErrors.empty())
|
||||
{
|
||||
wxMessageBox(strErrors, "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add wallet transactions that aren't already in a block to mapTransactions
|
||||
ReacceptWalletTransactions();
|
||||
|
||||
//
|
||||
// Parameters
|
||||
//
|
||||
if (mapArgs.count("-printblockindex") || mapArgs.count("-printblocktree"))
|
||||
{
|
||||
PrintBlockTree();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mapArgs.count("-printblock"))
|
||||
{
|
||||
string strMatch = mapArgs["-printblock"];
|
||||
int nFound = 0;
|
||||
for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
|
||||
{
|
||||
uint256 hash = (*mi).first;
|
||||
if (strncmp(hash.ToString().c_str(), strMatch.c_str(), strMatch.size()) == 0)
|
||||
{
|
||||
CBlockIndex* pindex = (*mi).second;
|
||||
CBlock block;
|
||||
block.ReadFromDisk(pindex);
|
||||
block.BuildMerkleTree();
|
||||
block.print();
|
||||
printf("\n");
|
||||
nFound++;
|
||||
}
|
||||
}
|
||||
if (nFound == 0)
|
||||
printf("No blocks matching %s were found\n", strMatch.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mapArgs.count("-gen"))
|
||||
{
|
||||
if (mapArgs["-gen"].empty())
|
||||
fGenerateBitcoins = true;
|
||||
else
|
||||
fGenerateBitcoins = (atoi(mapArgs["-gen"].c_str()) != 0);
|
||||
}
|
||||
|
||||
if (mapArgs.count("-proxy"))
|
||||
{
|
||||
fUseProxy = true;
|
||||
addrProxy = CAddress(mapArgs["-proxy"]);
|
||||
if (!addrProxy.IsValid())
|
||||
{
|
||||
wxMessageBox(_("Invalid -proxy address"), "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mapArgs.count("-addnode"))
|
||||
{
|
||||
foreach(string strAddr, mapMultiArgs["-addnode"])
|
||||
{
|
||||
CAddress addr(strAddr, NODE_NETWORK);
|
||||
addr.nTime = 0; // so it won't relay unless successfully connected
|
||||
if (addr.IsValid())
|
||||
AddAddress(addr);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Create the main frame window
|
||||
//
|
||||
if (!fDaemon)
|
||||
{
|
||||
pframeMain = new CMainFrame(NULL);
|
||||
if (mapArgs.count("-min"))
|
||||
pframeMain->Iconize(true);
|
||||
pframeMain->Show(true); // have to show first to get taskbar button to hide
|
||||
if (fMinimizeToTray && pframeMain->IsIconized())
|
||||
fClosedToTray = true;
|
||||
pframeMain->Show(!fClosedToTray);
|
||||
ptaskbaricon->Show(fMinimizeToTray || fClosedToTray);
|
||||
|
||||
CreateThread(ThreadDelayedRepaint, NULL);
|
||||
}
|
||||
|
||||
if (!CheckDiskSpace())
|
||||
return false;
|
||||
|
||||
RandAddSeedPerfmon();
|
||||
|
||||
if (!CreateThread(StartNode, NULL))
|
||||
wxMessageBox("Error: CreateThread(StartNode) failed", "Bitcoin");
|
||||
|
||||
if (mapArgs.count("-server") || fDaemon)
|
||||
CreateThread(ThreadRPCServer, NULL);
|
||||
|
||||
if (fFirstRun)
|
||||
SetStartOnSystemStartup(true);
|
||||
|
||||
|
||||
//
|
||||
// Tests
|
||||
//
|
||||
#ifdef __WXMSW__
|
||||
if (argc >= 2 && stricmp(argv[1], "-send") == 0)
|
||||
#else
|
||||
if (argc >= 2 && strcmp(argv[1], "-send") == 0)
|
||||
#endif
|
||||
{
|
||||
int64 nValue = 1;
|
||||
if (argc >= 3)
|
||||
ParseMoney(argv[2], nValue);
|
||||
|
||||
string strAddress;
|
||||
if (argc >= 4)
|
||||
strAddress = argv[3];
|
||||
CAddress addr(strAddress);
|
||||
|
||||
CWalletTx wtx;
|
||||
wtx.mapValue["to"] = strAddress;
|
||||
wtx.mapValue["from"] = addrLocalHost.ToString();
|
||||
wtx.mapValue["message"] = "command line send";
|
||||
|
||||
// Send to IP address
|
||||
CSendingDialog* pdialog = new CSendingDialog(pframeMain, addr, nValue, wtx);
|
||||
if (!pdialog->ShowModal())
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int CMyApp::OnExit()
|
||||
{
|
||||
Shutdown(NULL);
|
||||
return wxApp::OnExit();
|
||||
}
|
||||
|
||||
bool CMyApp::OnExceptionInMainLoop()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
PrintException(&e, "CMyApp::OnExceptionInMainLoop()");
|
||||
wxLogWarning("Exception %s %s", typeid(e).name(), e.what());
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PrintException(NULL, "CMyApp::OnExceptionInMainLoop()");
|
||||
wxLogWarning("Unknown exception");
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CMyApp::OnUnhandledException()
|
||||
{
|
||||
// this shows how we may let some exception propagate uncaught
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
PrintException(&e, "CMyApp::OnUnhandledException()");
|
||||
wxLogWarning("Exception %s %s", typeid(e).name(), e.what());
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
PrintException(NULL, "CMyApp::OnUnhandledException()");
|
||||
wxLogWarning("Unknown exception");
|
||||
Sleep(1000);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void CMyApp::OnFatalException()
|
||||
{
|
||||
wxMessageBox(_("Program has crashed and will terminate. "), "Bitcoin", wxOK | wxICON_ERROR);
|
||||
pframeMain = new CMainFrame(NULL);
|
||||
if (mapArgs.count("-min"))
|
||||
pframeMain->Iconize(true);
|
||||
pframeMain->Show(true); // have to show first to get taskbar button to hide
|
||||
if (fMinimizeToTray && pframeMain->IsIconized())
|
||||
fClosedToTray = true;
|
||||
pframeMain->Show(!fClosedToTray);
|
||||
ptaskbaricon->Show(fMinimizeToTray || fClosedToTray);
|
||||
CreateThread(ThreadDelayedRepaint, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __WXMSW__
|
||||
typedef WINSHELLAPI BOOL (WINAPI *PSHGETSPECIALFOLDERPATHA)(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
|
||||
|
||||
string MyGetSpecialFolderPath(int nFolder, bool fCreate)
|
||||
{
|
||||
char pszPath[MAX_PATH+100] = "";
|
||||
|
||||
// SHGetSpecialFolderPath is not usually available on NT 4.0
|
||||
HMODULE hShell32 = LoadLibraryA("shell32.dll");
|
||||
if (hShell32)
|
||||
{
|
||||
PSHGETSPECIALFOLDERPATHA pSHGetSpecialFolderPath =
|
||||
(PSHGETSPECIALFOLDERPATHA)GetProcAddress(hShell32, "SHGetSpecialFolderPathA");
|
||||
if (pSHGetSpecialFolderPath)
|
||||
(*pSHGetSpecialFolderPath)(NULL, pszPath, nFolder, fCreate);
|
||||
FreeModule(hShell32);
|
||||
}
|
||||
|
||||
// Backup option
|
||||
if (pszPath[0] == '\0')
|
||||
{
|
||||
if (nFolder == CSIDL_STARTUP)
|
||||
{
|
||||
strcpy(pszPath, getenv("USERPROFILE"));
|
||||
strcat(pszPath, "\\Start Menu\\Programs\\Startup");
|
||||
}
|
||||
else if (nFolder == CSIDL_APPDATA)
|
||||
{
|
||||
strcpy(pszPath, getenv("APPDATA"));
|
||||
}
|
||||
}
|
||||
|
||||
return pszPath;
|
||||
}
|
||||
|
||||
string StartupShortcutPath()
|
||||
{
|
||||
return MyGetSpecialFolderPath(CSIDL_STARTUP, true) + "\\Bitcoin.lnk";
|
||||
}
|
||||
|
||||
bool GetStartOnSystemStartup()
|
||||
{
|
||||
return wxFileExists(StartupShortcutPath());
|
||||
}
|
||||
|
||||
void SetStartOnSystemStartup(bool fAutoStart)
|
||||
{
|
||||
// If the shortcut exists already, remove it for updating
|
||||
remove(StartupShortcutPath().c_str());
|
||||
|
||||
if (fAutoStart)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
// Get a pointer to the IShellLink interface.
|
||||
IShellLink* psl = NULL;
|
||||
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL,
|
||||
CLSCTX_INPROC_SERVER, IID_IShellLink,
|
||||
reinterpret_cast<void**>(&psl));
|
||||
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
// Get the current executable path
|
||||
TCHAR pszExePath[MAX_PATH];
|
||||
GetModuleFileName(NULL, pszExePath, sizeof(pszExePath));
|
||||
|
||||
// Set the path to the shortcut target
|
||||
psl->SetPath(pszExePath);
|
||||
PathRemoveFileSpec(pszExePath);
|
||||
psl->SetWorkingDirectory(pszExePath);
|
||||
psl->SetShowCmd(SW_SHOWMINNOACTIVE);
|
||||
|
||||
// Query IShellLink for the IPersistFile interface for
|
||||
// saving the shortcut in persistent storage.
|
||||
IPersistFile* ppf = NULL;
|
||||
hres = psl->QueryInterface(IID_IPersistFile,
|
||||
reinterpret_cast<void**>(&ppf));
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
WCHAR pwsz[MAX_PATH];
|
||||
// Ensure that the string is ANSI.
|
||||
MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().c_str(), -1, pwsz, MAX_PATH);
|
||||
// Save the link by calling IPersistFile::Save.
|
||||
hres = ppf->Save(pwsz, TRUE);
|
||||
ppf->Release();
|
||||
}
|
||||
psl->Release();
|
||||
}
|
||||
CoUninitialize();
|
||||
}
|
||||
}
|
||||
#else
|
||||
bool GetStartOnSystemStartup() { return false; }
|
||||
void SetStartOnSystemStartup(bool fAutoStart) { }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
58
ui.h
58
ui.h
@@ -4,27 +4,71 @@
|
||||
|
||||
DECLARE_EVENT_TYPE(wxEVT_UITHREADCALL, -1)
|
||||
|
||||
#if wxUSE_GUI
|
||||
static const bool fGUI=true;
|
||||
#else
|
||||
static const bool fGUI=false;
|
||||
#endif
|
||||
|
||||
extern map<string, string> mapArgs;
|
||||
inline int MyMessageBox(const wxString& message, const wxString& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1)
|
||||
{
|
||||
#if wxUSE_GUI
|
||||
if (!fDaemon)
|
||||
return wxMessageBox(message, caption, style, parent, x, y);
|
||||
#endif
|
||||
printf("wxMessageBox %s: %s\n", string(caption).c_str(), string(message).c_str());
|
||||
fprintf(stderr, "%s: %s\n", string(caption).c_str(), string(message).c_str());
|
||||
return wxOK;
|
||||
}
|
||||
#define wxMessageBox MyMessageBox
|
||||
|
||||
// Settings
|
||||
extern int fMinimizeToTray;
|
||||
extern int fMinimizeOnClose;
|
||||
|
||||
|
||||
|
||||
void HandleCtrlA(wxKeyEvent& event);
|
||||
string FormatTxStatus(const CWalletTx& wtx);
|
||||
void UIThreadCall(boost::function0<void>);
|
||||
void MainFrameRepaint();
|
||||
void Shutdown(void* parg);
|
||||
int ThreadSafeMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1);
|
||||
bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent);
|
||||
void CalledSetStatusBar(const string& strText, int nField);
|
||||
void MainFrameRepaint();
|
||||
void CreateMainWindow();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if !wxUSE_GUI
|
||||
inline int ThreadSafeMessageBox(const string& message, const string& caption, int style, wxWindow* parent, int x, int y)
|
||||
{
|
||||
return MyMessageBox(message, caption, style, parent, x, y);
|
||||
}
|
||||
|
||||
inline bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void CalledSetStatusBar(const string& strText, int nField)
|
||||
{
|
||||
}
|
||||
|
||||
inline void UIThreadCall(boost::function0<void> fn)
|
||||
{
|
||||
}
|
||||
|
||||
inline void MainFrameRepaint()
|
||||
{
|
||||
}
|
||||
|
||||
inline void CreateMainWindow()
|
||||
{
|
||||
}
|
||||
#else // wxUSE_GUI
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CMainFrame : public CMainFrameBase
|
||||
{
|
||||
@@ -331,3 +375,5 @@ public:
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
16
uibase.cpp
16
uibase.cpp
@@ -24,7 +24,7 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
|
||||
m_menuFile = new wxMenu();
|
||||
wxMenuItem* m_menuFileExit;
|
||||
m_menuFileExit = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("E&xit") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
m_menuFileExit = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( _("E&xit") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
m_menuFile->Append( m_menuFileExit );
|
||||
|
||||
m_menubar->Append( m_menuFile, _("&File") );
|
||||
@@ -39,14 +39,14 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
m_menuOptions->Append( m_menuOptionsChangeYourAddress );
|
||||
|
||||
wxMenuItem* m_menuOptionsOptions;
|
||||
m_menuOptionsOptions = new wxMenuItem( m_menuOptions, wxID_MENUOPTIONSOPTIONS, wxString( _("&Options...") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
m_menuOptionsOptions = new wxMenuItem( m_menuOptions, wxID_PREFERENCES, wxString( _("&Options...") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
m_menuOptions->Append( m_menuOptionsOptions );
|
||||
|
||||
m_menubar->Append( m_menuOptions, _("&Settings") );
|
||||
|
||||
m_menuHelp = new wxMenu();
|
||||
wxMenuItem* m_menuHelpAbout;
|
||||
m_menuHelpAbout = new wxMenuItem( m_menuHelp, wxID_ANY, wxString( _("&About...") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
m_menuHelpAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About...") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
m_menuHelp->Append( m_menuHelpAbout );
|
||||
|
||||
m_menubar->Append( m_menuHelp, _("&Help") );
|
||||
@@ -133,7 +133,7 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
wxBoxSizer* bSizer11;
|
||||
bSizer11 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_listCtrlAll = new wxListCtrl( m_panel9, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING|wxVSCROLL );
|
||||
m_listCtrlAll = new wxListCtrl( m_panel9, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING );
|
||||
bSizer11->Add( m_listCtrlAll, 1, wxEXPAND, 5 );
|
||||
|
||||
m_panel9->SetSizer( bSizer11 );
|
||||
@@ -144,7 +144,7 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
wxBoxSizer* bSizer111;
|
||||
bSizer111 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_listCtrlSentReceived = new wxListCtrl( m_panel91, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING|wxVSCROLL );
|
||||
m_listCtrlSentReceived = new wxListCtrl( m_panel91, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING );
|
||||
bSizer111->Add( m_listCtrlSentReceived, 1, wxEXPAND, 5 );
|
||||
|
||||
m_panel91->SetSizer( bSizer111 );
|
||||
@@ -155,7 +155,7 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
wxBoxSizer* bSizer112;
|
||||
bSizer112 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_listCtrlSent = new wxListCtrl( m_panel92, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING|wxVSCROLL );
|
||||
m_listCtrlSent = new wxListCtrl( m_panel92, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING );
|
||||
bSizer112->Add( m_listCtrlSent, 1, wxEXPAND, 5 );
|
||||
|
||||
m_panel92->SetSizer( bSizer112 );
|
||||
@@ -166,7 +166,7 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
wxBoxSizer* bSizer113;
|
||||
bSizer113 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_listCtrlReceived = new wxListCtrl( m_panel93, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING|wxVSCROLL );
|
||||
m_listCtrlReceived = new wxListCtrl( m_panel93, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING );
|
||||
bSizer113->Add( m_listCtrlReceived, 1, wxEXPAND, 5 );
|
||||
|
||||
m_panel93->SetSizer( bSizer113 );
|
||||
@@ -616,7 +616,7 @@ CSendDialogBase::CSendDialogBase( wxWindow* parent, wxWindowID id, const wxStrin
|
||||
|
||||
fgSizer1->Add( 0, 0, 0, wxEXPAND, 5 );
|
||||
|
||||
m_staticTextInstructions = new wxStaticText( this, wxID_ANY, _("Enter the recipient's IP address (e.g. 123.45.6.7) for online transfer with comments and confirmation, \nor Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) if recipient is not online."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextInstructions = new wxStaticText( this, wxID_ANY, _("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextInstructions->Wrap( -1 );
|
||||
fgSizer1->Add( m_staticTextInstructions, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
49
uibase.h
49
uibase.h
@@ -42,29 +42,28 @@
|
||||
|
||||
#define wxID_MAINFRAME 1000
|
||||
#define wxID_OPTIONSGENERATEBITCOINS 1001
|
||||
#define wxID_MENUOPTIONSOPTIONS 1002
|
||||
#define wxID_BUTTONSEND 1003
|
||||
#define wxID_BUTTONRECEIVE 1004
|
||||
#define wxID_TEXTCTRLADDRESS 1005
|
||||
#define wxID_BUTTONNEW 1006
|
||||
#define wxID_BUTTONCOPY 1007
|
||||
#define wxID_TRANSACTIONFEE 1008
|
||||
#define wxID_PROXYIP 1009
|
||||
#define wxID_PROXYPORT 1010
|
||||
#define wxID_TEXTCTRLPAYTO 1011
|
||||
#define wxID_BUTTONPASTE 1012
|
||||
#define wxID_BUTTONADDRESSBOOK 1013
|
||||
#define wxID_TEXTCTRLAMOUNT 1014
|
||||
#define wxID_CHOICETRANSFERTYPE 1015
|
||||
#define wxID_LISTCTRL 1016
|
||||
#define wxID_BUTTONRENAME 1017
|
||||
#define wxID_PANELSENDING 1018
|
||||
#define wxID_LISTCTRLSENDING 1019
|
||||
#define wxID_PANELRECEIVING 1020
|
||||
#define wxID_LISTCTRLRECEIVING 1021
|
||||
#define wxID_BUTTONDELETE 1022
|
||||
#define wxID_BUTTONEDIT 1023
|
||||
#define wxID_TEXTCTRL 1024
|
||||
#define wxID_BUTTONSEND 1002
|
||||
#define wxID_BUTTONRECEIVE 1003
|
||||
#define wxID_TEXTCTRLADDRESS 1004
|
||||
#define wxID_BUTTONNEW 1005
|
||||
#define wxID_BUTTONCOPY 1006
|
||||
#define wxID_TRANSACTIONFEE 1007
|
||||
#define wxID_PROXYIP 1008
|
||||
#define wxID_PROXYPORT 1009
|
||||
#define wxID_TEXTCTRLPAYTO 1010
|
||||
#define wxID_BUTTONPASTE 1011
|
||||
#define wxID_BUTTONADDRESSBOOK 1012
|
||||
#define wxID_TEXTCTRLAMOUNT 1013
|
||||
#define wxID_CHOICETRANSFERTYPE 1014
|
||||
#define wxID_LISTCTRL 1015
|
||||
#define wxID_BUTTONRENAME 1016
|
||||
#define wxID_PANELSENDING 1017
|
||||
#define wxID_LISTCTRLSENDING 1018
|
||||
#define wxID_PANELRECEIVING 1019
|
||||
#define wxID_LISTCTRLRECEIVING 1020
|
||||
#define wxID_BUTTONDELETE 1021
|
||||
#define wxID_BUTTONEDIT 1022
|
||||
#define wxID_TEXTCTRL 1023
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class CMainFrameBase
|
||||
@@ -78,7 +77,6 @@ class CMainFrameBase : public wxFrame
|
||||
wxMenu* m_menuFile;
|
||||
wxMenu* m_menuHelp;
|
||||
wxToolBar* m_toolBar;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
||||
wxStaticText* m_staticText32;
|
||||
wxButton* m_buttonNew;
|
||||
@@ -122,6 +120,7 @@ class CMainFrameBase : public wxFrame
|
||||
|
||||
public:
|
||||
wxMenu* m_menuOptions;
|
||||
wxStatusBar* m_statusBar;
|
||||
wxTextCtrl* m_textCtrlAddress;
|
||||
wxListCtrl* m_listCtrlAll;
|
||||
wxListCtrl* m_listCtrlSentReceived;
|
||||
@@ -276,7 +275,7 @@ class CSendDialogBase : public wxDialog
|
||||
|
||||
|
||||
public:
|
||||
CSendDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Send Coins"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 675,312 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
CSendDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Send Coins"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 675,298 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~CSendDialogBase();
|
||||
|
||||
};
|
||||
|
||||
@@ -388,7 +388,6 @@ typedef base_uint<256> base_uint256;
|
||||
//
|
||||
// uint160 and uint256 could be implemented as templates, but to keep
|
||||
// compile errors and debugging cleaner, they're copy and pasted.
|
||||
// It's safe to search and replace 160 with 256 and vice versa.
|
||||
//
|
||||
|
||||
|
||||
@@ -405,6 +404,8 @@ public:
|
||||
|
||||
uint160()
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = 0;
|
||||
}
|
||||
|
||||
uint160(const basetype& b)
|
||||
@@ -517,6 +518,8 @@ public:
|
||||
|
||||
uint256()
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = 0;
|
||||
}
|
||||
|
||||
uint256(const basetype& b)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<property name="relative_path">1</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Frame" expanded="1">
|
||||
<object class="Frame" expanded="0">
|
||||
<property name="bg">wxSYS_COLOUR_BTNFACE</property>
|
||||
<property name="center"></property>
|
||||
<property name="context_help"></property>
|
||||
@@ -123,7 +123,7 @@
|
||||
<property name="checked">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="help"></property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="id">wxID_EXIT</property>
|
||||
<property name="kind">wxITEM_NORMAL</property>
|
||||
<property name="label">E&xit</property>
|
||||
<property name="name">m_menuFileExit</property>
|
||||
@@ -173,7 +173,7 @@
|
||||
<property name="checked">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="help"></property>
|
||||
<property name="id">wxID_MENUOPTIONSOPTIONS</property>
|
||||
<property name="id">wxID_PREFERENCES</property>
|
||||
<property name="kind">wxITEM_NORMAL</property>
|
||||
<property name="label">&Options...</property>
|
||||
<property name="name">m_menuOptionsOptions</property>
|
||||
@@ -193,7 +193,7 @@
|
||||
<property name="checked">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="help"></property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="id">wxID_ABOUT</property>
|
||||
<property name="kind">wxITEM_NORMAL</property>
|
||||
<property name="label">&About...</property>
|
||||
<property name="name">m_menuHelpAbout</property>
|
||||
@@ -293,7 +293,7 @@
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_statusBar</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="permission">public</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxST_SIZEGRIP</property>
|
||||
@@ -924,7 +924,7 @@
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxVSCROLL</property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -1047,7 +1047,7 @@
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxVSCROLL</property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -1170,7 +1170,7 @@
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxVSCROLL</property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -1293,7 +1293,7 @@
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxVSCROLL</property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@@ -3317,7 +3317,7 @@
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">CSendDialogBase</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">675,312</property>
|
||||
<property name="size">675,298</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="title">Send Coins</property>
|
||||
@@ -3408,7 +3408,7 @@
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Enter the recipient's IP address (e.g. 123.45.6.7) for online transfer with comments and confirmation, 
or Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) if recipient is not online.</property>
|
||||
<property name="label">Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_staticTextInstructions</property>
|
||||
|
||||
38
util.cpp
38
util.cpp
@@ -250,11 +250,6 @@ string strprintf(const char* format, ...)
|
||||
if (p == NULL)
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
// msvc optimisation
|
||||
if (p == buffer)
|
||||
return string(p, p+ret);
|
||||
#endif
|
||||
string str(p, p+ret);
|
||||
if (p != buffer)
|
||||
delete p;
|
||||
@@ -282,15 +277,21 @@ bool error(const char* format, ...)
|
||||
|
||||
void ParseString(const string& str, char c, vector<string>& v)
|
||||
{
|
||||
unsigned int i1 = 0;
|
||||
unsigned int i2;
|
||||
do
|
||||
if (str.empty())
|
||||
return;
|
||||
string::size_type i1 = 0;
|
||||
string::size_type i2;
|
||||
loop
|
||||
{
|
||||
i2 = str.find(c, i1);
|
||||
if (i2 == str.npos)
|
||||
{
|
||||
v.push_back(str.substr(i1));
|
||||
return;
|
||||
}
|
||||
v.push_back(str.substr(i1, i2-i1));
|
||||
i1 = i2+1;
|
||||
}
|
||||
while (i2 != str.npos);
|
||||
}
|
||||
|
||||
|
||||
@@ -308,6 +309,12 @@ string FormatMoney(int64 n, bool fPlus)
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
bool ParseMoney(const string& str, int64& nRet)
|
||||
{
|
||||
return ParseMoney(str.c_str(), nRet);
|
||||
}
|
||||
|
||||
bool ParseMoney(const char* pszIn, int64& nRet)
|
||||
{
|
||||
string strWhole;
|
||||
@@ -445,20 +452,21 @@ const char* wxGetTranslation(const char* pszEnglish)
|
||||
return (*mi).second;
|
||||
|
||||
// wxWidgets translation
|
||||
const char* pszTranslated = wxGetTranslation(wxString(pszEnglish, wxConvUTF8)).utf8_str();
|
||||
wxString strTranslated = wxGetTranslation(wxString(pszEnglish, wxConvUTF8));
|
||||
|
||||
// We don't cache unknown strings because caller might be passing in a
|
||||
// dynamic string and we would keep allocating memory for each variation.
|
||||
if (strcmp(pszEnglish, pszTranslated) == 0)
|
||||
if (strcmp(pszEnglish, strTranslated.utf8_str()) == 0)
|
||||
return pszEnglish;
|
||||
|
||||
// Add to cache, memory doesn't need to be freed. We only cache because
|
||||
// we must pass back a pointer to permanently allocated memory.
|
||||
char* pszCached = new char[strlen(pszTranslated)+1];
|
||||
strcpy(pszCached, pszTranslated);
|
||||
char* pszCached = new char[strlen(strTranslated.utf8_str())+1];
|
||||
strcpy(pszCached, strTranslated.utf8_str());
|
||||
mapCache[pszEnglish] = pszCached;
|
||||
return pszCached;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -502,8 +510,8 @@ void PrintException(std::exception* pex, const char* pszThread)
|
||||
FormatException(pszMessage, pex, pszThread);
|
||||
printf("\n\n************************\n%s\n", pszMessage);
|
||||
fprintf(stderr, "\n\n************************\n%s\n", pszMessage);
|
||||
if (wxTheApp && !fDaemon)
|
||||
wxMessageBox(pszMessage, "Error", wxOK | wxICON_ERROR);
|
||||
if (wxTheApp && !fDaemon && fGUI)
|
||||
MyMessageBox(pszMessage, "Error", wxOK | wxICON_ERROR);
|
||||
throw;
|
||||
//DebugBreak();
|
||||
}
|
||||
|
||||
10
util.h
10
util.h
@@ -133,6 +133,7 @@ void PrintException(std::exception* pex, const char* pszThread);
|
||||
void LogException(std::exception* pex, const char* pszThread);
|
||||
void ParseString(const string& str, char c, vector<string>& v);
|
||||
string FormatMoney(int64 n, bool fPlus=false);
|
||||
bool ParseMoney(const string& str, int64& nRet);
|
||||
bool ParseMoney(const char* pszIn, int64& nRet);
|
||||
vector<unsigned char> ParseHex(const char* psz);
|
||||
vector<unsigned char> ParseHex(const std::string& str);
|
||||
@@ -519,8 +520,13 @@ inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=fa
|
||||
|
||||
inline void SetThreadPriority(int nPriority)
|
||||
{
|
||||
// threads are processes on linux, so PRIO_PROCESS affects just the one thread
|
||||
setpriority(PRIO_PROCESS, getpid(), nPriority);
|
||||
// It's unclear if it's even possible to change thread priorities on Linux,
|
||||
// but we really and truly need it for the generation threads.
|
||||
#ifdef PRIO_THREAD
|
||||
setpriority(PRIO_THREAD, 0, nPriority);
|
||||
#else
|
||||
setpriority(PRIO_PROCESS, 0, nPriority);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool TerminateThread(pthread_t hthread, unsigned int nExitCode)
|
||||
|
||||
Reference in New Issue
Block a user