aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--headers.h16
-rw-r--r--init.cpp16
-rw-r--r--locale/de/LC_MESSAGES/bitcoin.mobin16083 -> 16116 bytes
-rw-r--r--locale/de/LC_MESSAGES/bitcoin.po12
-rw-r--r--locale/es/LC_MESSAGES/bitcoin.mobin14996 -> 15040 bytes
-rw-r--r--locale/es/LC_MESSAGES/bitcoin.po12
-rw-r--r--locale/fr/LC_MESSAGES/bitcoin.mobin15723 -> 15771 bytes
-rw-r--r--locale/fr/LC_MESSAGES/bitcoin.po12
-rw-r--r--locale/it/LC_MESSAGES/bitcoin.mobin15607 -> 15643 bytes
-rw-r--r--locale/it/LC_MESSAGES/bitcoin.po12
-rw-r--r--locale/nl/LC_MESSAGES/bitcoin.mobin14914 -> 14946 bytes
-rw-r--r--locale/nl/LC_MESSAGES/bitcoin.po12
-rw-r--r--locale/pt/LC_MESSAGES/bitcoin.mobin15654 -> 15684 bytes
-rw-r--r--locale/pt/LC_MESSAGES/bitcoin.po12
-rw-r--r--main.cpp2
-rw-r--r--net.cpp30
-rw-r--r--rpc.cpp4
-rw-r--r--serialize.h2
-rw-r--r--ui.cpp14
-rw-r--r--util.h15
20 files changed, 132 insertions, 39 deletions
diff --git a/headers.h b/headers.h
index a0b4c5edcf..5c9e6e324a 100644
--- a/headers.h
+++ b/headers.h
@@ -18,6 +18,14 @@
#define _WIN32_IE 0x0400
#define WIN32_LEAN_AND_MEAN 1
#define __STDC_LIMIT_MACROS // to enable UINT64_MAX from stdint.h
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
+#include <sys/param.h> // to get BSD define
+#endif
+#ifdef __WXMAC_OSX__
+#ifndef BSD
+#define BSD 1
+#endif
+#endif
#ifdef GUI
#include <wx/wx.h>
#include <wx/stdpaths.h>
@@ -25,12 +33,6 @@
#include <wx/utils.h>
#include <wx/clipbrd.h>
#include <wx/taskbar.h>
-#else
-#ifdef __WXMAC_OSX__
-#define __WXMAC__ 1
-#define __WXOSX__ 1
-#define __BSD__ 1
-#endif
#endif
#include <openssl/buffer.h>
#include <openssl/ecdsa.h>
@@ -98,7 +100,7 @@
#include <ifaddrs.h>
#include <fcntl.h>
#endif
-#ifdef __BSD__
+#ifdef BSD
#include <netinet/in.h>
#endif
diff --git a/init.cpp b/init.cpp
index 0eacebc305..b99237ec66 100644
--- a/init.cpp
+++ b/init.cpp
@@ -137,7 +137,10 @@ bool AppInit2(int argc, char* argv[])
ParseParameters(argc, argv);
if (mapArgs.count("-datadir"))
- strlcpy(pszSetDataDir, mapArgs["-datadir"].c_str(), sizeof(pszSetDataDir));
+ {
+ filesystem::path pathDataDir = filesystem::system_complete(mapArgs["-datadir"]);
+ strlcpy(pszSetDataDir, pathDataDir.string().c_str(), sizeof(pszSetDataDir));
+ }
ReadConfigFile(mapArgs, mapMultiArgs); // Must be done after processing datadir
@@ -363,6 +366,15 @@ bool AppInit2(int argc, char* argv[])
}
}
+ if (mapArgs.count("-paytxfee"))
+ {
+ if (!ParseMoney(mapArgs["-paytxfee"], nTransactionFee))
+ {
+ wxMessageBox(_("Invalid amount for -paytxfee=<amount>"), "Bitcoin");
+ return false;
+ }
+ }
+
//
// Create the main window and start the node
//
@@ -382,7 +394,7 @@ bool AppInit2(int argc, char* argv[])
if (mapArgs.count("-server") || fDaemon)
CreateThread(ThreadRPCServer, NULL);
-#ifdef GUI
+#if defined(__WXMSW__) && defined(GUI)
if (fFirstRun)
SetStartOnSystemStartup(true);
#endif
diff --git a/locale/de/LC_MESSAGES/bitcoin.mo b/locale/de/LC_MESSAGES/bitcoin.mo
index 2b5ff6f963..5d7eeb2b87 100644
--- a/locale/de/LC_MESSAGES/bitcoin.mo
+++ b/locale/de/LC_MESSAGES/bitcoin.mo
Binary files differ
diff --git a/locale/de/LC_MESSAGES/bitcoin.po b/locale/de/LC_MESSAGES/bitcoin.po
index b8857929ab..427aebc45b 100644
--- a/locale/de/LC_MESSAGES/bitcoin.po
+++ b/locale/de/LC_MESSAGES/bitcoin.po
@@ -184,8 +184,8 @@ msgid "From: "
msgstr "Von: "
#: ../../../ui.cpp:634
-msgid "From: unknown, Received with: "
-msgstr "Von: Unbekannt, Empfangen durch: "
+msgid "Received with: "
+msgstr "Empfangen durch: "
#: ../../../ui.cpp:676
msgid "Payment to yourself"
@@ -328,6 +328,14 @@ msgstr "Version 0.%d.%d Beta"
msgid "Will appear as \"From: Unknown\""
msgstr "Wird als \"Von: Unbekannt\" erscheinen"
+#: ../../../ui.cpp:1681
+msgid "n/a"
+msgstr "Unbekannt"
+
+#: ../../../ui.cpp:1681
+msgid "Unknown"
+msgstr "Unbekannt"
+
#: ../../../ui.cpp:1682
msgid "Can't include a message when sending to a Bitcoin address"
msgstr "Beim überweisen an eine Bitcoin-Adresse kann keine Nachricht angegeben werden."
diff --git a/locale/es/LC_MESSAGES/bitcoin.mo b/locale/es/LC_MESSAGES/bitcoin.mo
index 8d7cf0ba68..da857ffd4f 100644
--- a/locale/es/LC_MESSAGES/bitcoin.mo
+++ b/locale/es/LC_MESSAGES/bitcoin.mo
Binary files differ
diff --git a/locale/es/LC_MESSAGES/bitcoin.po b/locale/es/LC_MESSAGES/bitcoin.po
index b55a8daa70..37297eec19 100644
--- a/locale/es/LC_MESSAGES/bitcoin.po
+++ b/locale/es/LC_MESSAGES/bitcoin.po
@@ -210,8 +210,8 @@ msgid "From: "
msgstr "De: "
#: ../../../ui.cpp:634
-msgid "From: unknown, Received with: "
-msgstr "De: desconocido, Recibido con: "
+msgid "Received with: "
+msgstr "Recibido con: "
#: ../../../ui.cpp:676
msgid "Payment to yourself"
@@ -357,6 +357,14 @@ msgstr "version %d.%d.%d beta"
msgid "Will appear as \"From: Unknown\""
msgstr "Aparecera como \"De: Desconocido\""
+#: ../../../ui.cpp:1696
+msgid "n/a"
+msgstr "Desconocido"
+
+#: ../../../ui.cpp:1696
+msgid "Unknown"
+msgstr "Desconocido"
+
#: ../../../ui.cpp:1697
msgid "Can't include a message when sending to a Bitcoin address"
msgstr "No se ha podido incluir un mensaje mientras se enviaba la direccion Bitcoin"
diff --git a/locale/fr/LC_MESSAGES/bitcoin.mo b/locale/fr/LC_MESSAGES/bitcoin.mo
index 25db2af273..59d28be895 100644
--- a/locale/fr/LC_MESSAGES/bitcoin.mo
+++ b/locale/fr/LC_MESSAGES/bitcoin.mo
Binary files differ
diff --git a/locale/fr/LC_MESSAGES/bitcoin.po b/locale/fr/LC_MESSAGES/bitcoin.po
index 46ee83c200..735914cf73 100644
--- a/locale/fr/LC_MESSAGES/bitcoin.po
+++ b/locale/fr/LC_MESSAGES/bitcoin.po
@@ -210,8 +210,8 @@ msgid "From: "
msgstr "De: "
#: ../../../ui.cpp:634
-msgid "From: unknown, Received with: "
-msgstr "De: Inconnu, reçu depuis: "
+msgid "Received with: "
+msgstr "Reçu depuis: "
#: ../../../ui.cpp:676
msgid "Payment to yourself"
@@ -358,6 +358,14 @@ msgstr "version %d.%d.%d beta"
msgid "Will appear as \"From: Unknown\""
msgstr "Apparaîtra ainsi \"De: Inconnu\""
+#: ../../../ui.cpp:1681
+msgid "n/a"
+msgstr "Inconnu"
+
+#: ../../../ui.cpp:1681
+msgid "Unknown"
+msgstr "Inconnu"
+
#: ../../../ui.cpp:1697
msgid "Can't include a message when sending to a Bitcoin address"
msgstr "Impossible d'inclure un message lors d'un envoi à une adresse Bitcoin"
diff --git a/locale/it/LC_MESSAGES/bitcoin.mo b/locale/it/LC_MESSAGES/bitcoin.mo
index 4a4f7a3fd1..2ce12e2fb6 100644
--- a/locale/it/LC_MESSAGES/bitcoin.mo
+++ b/locale/it/LC_MESSAGES/bitcoin.mo
Binary files differ
diff --git a/locale/it/LC_MESSAGES/bitcoin.po b/locale/it/LC_MESSAGES/bitcoin.po
index ef75bf6219..c24174432a 100644
--- a/locale/it/LC_MESSAGES/bitcoin.po
+++ b/locale/it/LC_MESSAGES/bitcoin.po
@@ -184,8 +184,8 @@ msgid "From: "
msgstr "Da: "
#: ../../../ui.cpp:634
-msgid "From: unknown, Received with: "
-msgstr "Da: sconosciuto, Ricevuto con: "
+msgid "Received with: "
+msgstr "Ricevuto con: "
#: ../../../ui.cpp:676
msgid "Payment to yourself"
@@ -326,6 +326,14 @@ msgstr "versione 0.%d.%d beta"
msgid "Will appear as \"From: Unknown\""
msgstr "Apparirà come \"Da: Sconosciuto\""
+#: ../../../ui.cpp:1681
+msgid "n/a"
+msgstr "Sconosciuto"
+
+#: ../../../ui.cpp:1681
+msgid "Unknown"
+msgstr "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"
diff --git a/locale/nl/LC_MESSAGES/bitcoin.mo b/locale/nl/LC_MESSAGES/bitcoin.mo
index 2b515433b0..66015f3144 100644
--- a/locale/nl/LC_MESSAGES/bitcoin.mo
+++ b/locale/nl/LC_MESSAGES/bitcoin.mo
Binary files differ
diff --git a/locale/nl/LC_MESSAGES/bitcoin.po b/locale/nl/LC_MESSAGES/bitcoin.po
index 54ef4d3c67..cfb05fb3c2 100644
--- a/locale/nl/LC_MESSAGES/bitcoin.po
+++ b/locale/nl/LC_MESSAGES/bitcoin.po
@@ -184,8 +184,8 @@ msgid "From: "
msgstr "Van: "
#: ../../../ui.cpp:634
-msgid "From: unknown, Received with: "
-msgstr "Van: onbekend, Ontvangen met: "
+msgid "Received with: "
+msgstr "Ontvangen met: "
#: ../../../ui.cpp:676
msgid "Payment to yourself"
@@ -327,6 +327,14 @@ msgstr "versie 0.%d.%d beta"
msgid "Will appear as \"From: Unknown\""
msgstr "Word vertoont als \"Van: Onbekend\""
+#: ../../../ui.cpp:1681
+msgid "n/a"
+msgstr "Onbekend"
+
+#: ../../../ui.cpp:1681
+msgid "Unknown"
+msgstr "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"
diff --git a/locale/pt/LC_MESSAGES/bitcoin.mo b/locale/pt/LC_MESSAGES/bitcoin.mo
index dceec49df2..fc97f39561 100644
--- a/locale/pt/LC_MESSAGES/bitcoin.mo
+++ b/locale/pt/LC_MESSAGES/bitcoin.mo
Binary files differ
diff --git a/locale/pt/LC_MESSAGES/bitcoin.po b/locale/pt/LC_MESSAGES/bitcoin.po
index 48102a1368..c0e4fd65af 100644
--- a/locale/pt/LC_MESSAGES/bitcoin.po
+++ b/locale/pt/LC_MESSAGES/bitcoin.po
@@ -184,8 +184,8 @@ msgid "From: "
msgstr "Remetente: "
#: ../../../ui.cpp:634
-msgid "From: unknown, Received with: "
-msgstr "Remetente: desconhecido, Recebido por: "
+msgid "Received with: "
+msgstr "Recebido por: "
#: ../../../ui.cpp:676
msgid "Payment to yourself"
@@ -326,6 +326,14 @@ msgstr "versão 0.%d.%d beta"
msgid "Will appear as \"From: Unknown\""
msgstr "Irá aparecer como \"De: Desconhecido\""
+#: ../../../ui.cpp:1681
+msgid "n/a"
+msgstr "Desconhecido"
+
+#: ../../../ui.cpp:1681
+msgid "Unknown"
+msgstr "Desconhecido"
+
#: ../../../ui.cpp:1682
msgid "Can't include a message when sending to a Bitcoin address"
msgstr "Não é possível incluir uma mensagem ao enviar para um endereço Bitcoin"
diff --git a/main.cpp b/main.cpp
index 441f49aca1..4b7146577c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -2224,7 +2224,7 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
// This includes all nodes that are currently online,
// since they rebroadcast an addr every 24 hours
pfrom->vAddrToSend.clear();
- int64 nSince = GetAdjustedTime() - 24 * 60 * 60; // in the last 24 hours
+ int64 nSince = GetAdjustedTime() - 12 * 60 * 60; // in the last 12 hours
CRITICAL_BLOCK(cs_mapAddresses)
{
unsigned int nSize = mapAddresses.size();
diff --git a/net.cpp b/net.cpp
index 1da1edbb11..1cdecd0980 100644
--- a/net.cpp
+++ b/net.cpp
@@ -66,7 +66,7 @@ bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet)
SOCKET hSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (hSocket == INVALID_SOCKET)
return false;
-#if defined(__BSD__) || defined(__WXMAC_OSX__)
+#ifdef BSD
int set = 1;
setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int));
#endif
@@ -808,6 +808,7 @@ void ThreadSocketHandler2(void* parg)
unsigned int pnSeed[] =
{
+ // 2010/06
0x35218252, 0x9c9c9618, 0xda6bacad, 0xb9aca862, 0x97c235c6,
0x146f9562, 0xb67b9e4b, 0x87cf4bc0, 0xb83945d0, 0x984333ad,
0xbbeec555, 0x6f0eb440, 0xe0005318, 0x7797e460, 0xddc60fcc,
@@ -818,6 +819,31 @@ unsigned int pnSeed[] =
0xdd3462d0, 0x4e4d1448, 0x171df645, 0x84ee1155,
0x248ac445, 0x0e634444, 0x0ded1b63, 0x30c01e60,
0xa2b9a094, 0x29e4fd43, 0x9ce61b4c, 0xdae09744,
+
+ // 2010/08
+ 0x5ae6bf43, 0x460be257, 0x7245c0cf, 0x4e0f028d, 0x26501760, 0x38643255, 0x67094f4f, 0x480449b8,
+ 0x16545143, 0x1f082e5a, 0xaa428018, 0xe411e793, 0x14c1f862, 0x2726105b, 0x9b33ea50, 0xeeef86ca,
+ 0xe3210d44, 0x0dca8b63, 0x3f9dfb18, 0x860340ad, 0xf33ba17a, 0x9018375c, 0x1de4e353, 0x0fa52dcb,
+ 0x89c4555b, 0x109cf37b, 0x28c55b40, 0x04c801ae, 0x275c1e80, 0x6f7f745d, 0x7a2a5653, 0xa28e26d8,
+ 0xa4e65db2, 0x99a06580, 0xf253ba44, 0x82cf6ab8, 0x859c2e8e, 0xf71a815d, 0xc18f1454, 0x71c8a943,
+ 0x90d24e18, 0x311789b2, 0x74aba645, 0xde0bbfc3, 0xad724fad, 0xbf1ae15e, 0xbaa6fb54, 0x06e4d145,
+ 0x51528645, 0x72120cd4, 0xd4cfd145, 0x0a7afed8, 0x9b9a5fad, 0x9e9ff45e, 0x10128355, 0xd44e8646,
+ 0x04a07b47, 0x5fc9d547, 0xe0491e45, 0xbac21b41, 0x7aa31bae, 0x10483c5f, 0x94a23055, 0x73d9dc47,
+ 0x1a99c247, 0x822fe847, 0x7e57ba48, 0xb19ea843, 0xa60621b2, 0x778cf163, 0x125c6556, 0xf94ba44f,
+ 0xa61a0948, 0x6c839e4b, 0x29af5348, 0x68d84845, 0x752b95c3, 0xcf0d4663, 0x08e11e56, 0x75109550,
+ 0x5f24b94c, 0x42426d4d, 0xfbbc0a4c, 0x70a9a246, 0xda7837cb, 0xae2a986d, 0xe283c358, 0x0c7ca954,
+ 0x8e9bde59, 0x61521760, 0x6884444c, 0xa194e548, 0x9b8809cc, 0x16e96a8f, 0x956ff859, 0xfad5e555,
+ 0x0ea70c80, 0x5b4ce26d, 0x7984444c, 0x1080d24a, 0x22a686cf, 0x6bf8c2ad, 0xb0f7485f, 0x06b66e56,
+ 0x668373bc, 0x75506279, 0x3868694e, 0x12a5954b, 0x3a8b62d1, 0xb74fcbad, 0xa7dc3360, 0xc070b359,
+ 0xa2b87242, 0xc45cab7c, 0x69882050, 0x14a5464b, 0x386acad5, 0x80b85db2, 0x1f78a062, 0xc608c55b,
+ 0x4257d543, 0x7636ad80, 0x4432d655, 0xb2114d4b, 0x32639bd9, 0xadd75db2, 0x9be5a362, 0x6831bc5e,
+ 0xf7f77046, 0x8f35ba81, 0x09bb4e59, 0xd0fb6b4e, 0xc5daa445, 0x9c611618, 0x355dcc62, 0xf2cf435e,
+ 0x31e72c46, 0xdd8a43ad, 0x171f9c5b, 0xb4c2e355, 0xbe8af945, 0x613d3942, 0xe6f9e863, 0x7a3d855f,
+ 0xa66adc47, 0x261089b2, 0x5a27105b, 0x6c28105b, 0xdd247946, 0xe6c3a445, 0x43a1ec63, 0x99b4dd5f,
+ 0xb6834347, 0x5e9649bc, 0xf9dd545d, 0x6ae4c15b, 0xa5318a47, 0x7984ec47, 0x93a73b63, 0x0c60195f,
+ 0xa5c85e4b, 0xa0a36dc2, 0x0739a95e, 0x3d44c15b, 0xfb940f4b, 0xd67c9148, 0x614f9876, 0x0a241c5f,
+ 0xad9da74c, 0x4459abc8, 0x12e71b5f, 0x1c534a5d, 0x8ff5fc50, 0x2ca8864b, 0xd894fd80, 0x82ab3160,
+ 0x390d804e, 0x2cf310cc, 0x680dad80, 0x691be15e, 0x5a8f4652, 0xaad0784d, 0x0d2431ad,
};
@@ -1179,7 +1205,7 @@ bool BindListenPort(string& strError)
return false;
}
-#if defined(__BSD__) || defined(__WXMAC_OSX__)
+#ifdef BSD
// Different way of disabling SIGPIPE on BSD
setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int));
#endif
diff --git a/rpc.cpp b/rpc.cpp
index 0fef539881..d03a7ce767 100644
--- a/rpc.cpp
+++ b/rpc.cpp
@@ -974,8 +974,8 @@ void ThreadRPCServer2(void* parg)
printf("ThreadRPCServer method=%s\n", strMethod.c_str());
// Observe lockdown
- if (IsLockdown() && strMethod != "help" && strMethod != "stop" && strMethod != "getgenerate" && strMethod != "setgenerate")
- throw runtime_error("WARNING: Displayed transactions may not be correct! You may need to upgrade.");
+ if (IsLockdown() && !mapArgs.count("-overridesafety") && strMethod != "help" && strMethod != "stop" && strMethod != "getgenerate" && strMethod != "setgenerate")
+ throw runtime_error("WARNING: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.");
// Execute
map<string, rpcfn_type>::iterator mi = mapCallTable.find(strMethod);
diff --git a/serialize.h b/serialize.h
index 1afd6c0edc..0c60bb9e03 100644
--- a/serialize.h
+++ b/serialize.h
@@ -20,7 +20,7 @@ class CDataStream;
class CAutoFile;
static const int VERSION = 308;
-static const char* pszSubVer = ".3";
+static const char* pszSubVer = ".4";
diff --git a/ui.cpp b/ui.cpp
index a6305fe1bd..885adeaa82 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -515,7 +515,7 @@ string SingleLine(const string& strIn)
{
string strOut;
bool fOneSpace = false;
- foreach(int c, strIn)
+ foreach(unsigned char c, strIn)
{
if (isspace(c))
{
@@ -640,7 +640,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
{
//strDescription += _("Received payment to ");
//strDescription += _("Received with address ");
- strDescription += _("From: unknown, Received with: ");
+ strDescription += _("Received with: ");
string strAddress = PubKeyToAddress(vchPubKey);
map<string, string>::iterator mi = mapAddressBook.find(strAddress);
if (mi != mapAddressBook.end() && !(*mi).second.empty())
@@ -1559,6 +1559,11 @@ void SetStartOnSystemStartup(bool fAutoStart)
}
else
{
+ char pszExePath[MAX_PATH+1];
+ memset(pszExePath, 0, sizeof(pszExePath));
+ if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1)
+ return;
+
boost::filesystem::create_directories(GetAutostartDir());
boost::filesystem::ofstream optionFile(GetAutostartFilePath(), ios_base::out|ios_base::trunc);
@@ -1568,9 +1573,6 @@ void SetStartOnSystemStartup(bool fAutoStart)
return;
}
// Write a bitcoin.desktop file to the autostart directory:
- char pszExePath[MAX_PATH+1];
- memset(pszExePath, 0, sizeof(pszExePath));
- readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1);
optionFile << "[Desktop Entry]\n";
optionFile << "Type=Application\n";
optionFile << "Name=Bitcoin\n";
@@ -1858,7 +1860,7 @@ void CSendDialog::OnTextAddress(wxCommandEvent& event)
{
strFromSave = m_textCtrlFrom->GetValue();
strMessageSave = m_textCtrlMessage->GetValue();
- m_textCtrlFrom->SetValue(_("Will appear as \"From: Unknown\""));
+ m_textCtrlFrom->SetValue(_("n/a"));
m_textCtrlMessage->SetValue(_("Can't include a message when sending to a Bitcoin address"));
}
else if (fEnable && !fEnabledPrev)
diff --git a/util.h b/util.h
index 9ec701b9e7..bf8cf300fd 100644
--- a/util.h
+++ b/util.h
@@ -430,8 +430,9 @@ inline void heapchk()
template<typename T1>
inline uint256 Hash(const T1 pbegin, const T1 pend)
{
+ static unsigned char pblank[1];
uint256 hash1;
- SHA256((unsigned char*)&pbegin[0], (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1);
+ SHA256((pbegin == pend ? pblank : (unsigned char*)&pbegin[0]), (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1);
uint256 hash2;
SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
return hash2;
@@ -441,11 +442,12 @@ template<typename T1, typename T2>
inline uint256 Hash(const T1 p1begin, const T1 p1end,
const T2 p2begin, const T2 p2end)
{
+ static unsigned char pblank[1];
uint256 hash1;
SHA256_CTX ctx;
SHA256_Init(&ctx);
- SHA256_Update(&ctx, (unsigned char*)&p1begin[0], (p1end - p1begin) * sizeof(p1begin[0]));
- SHA256_Update(&ctx, (unsigned char*)&p2begin[0], (p2end - p2begin) * sizeof(p2begin[0]));
+ SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0]));
+ SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0]));
SHA256_Final((unsigned char*)&hash1, &ctx);
uint256 hash2;
SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
@@ -457,12 +459,13 @@ inline uint256 Hash(const T1 p1begin, const T1 p1end,
const T2 p2begin, const T2 p2end,
const T3 p3begin, const T3 p3end)
{
+ static unsigned char pblank[1];
uint256 hash1;
SHA256_CTX ctx;
SHA256_Init(&ctx);
- SHA256_Update(&ctx, (unsigned char*)&p1begin[0], (p1end - p1begin) * sizeof(p1begin[0]));
- SHA256_Update(&ctx, (unsigned char*)&p2begin[0], (p2end - p2begin) * sizeof(p2begin[0]));
- SHA256_Update(&ctx, (unsigned char*)&p3begin[0], (p3end - p3begin) * sizeof(p3begin[0]));
+ SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0]));
+ SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0]));
+ SHA256_Update(&ctx, (p3begin == p3end ? pblank : (unsigned char*)&p3begin[0]), (p3end - p3begin) * sizeof(p3begin[0]));
SHA256_Final((unsigned char*)&hash1, &ctx);
uint256 hash2;
SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);