Wladimir J. van der Laan 14 years ago
parent
commit
330c190958
  1. 2
      locale/nl/LC_MESSAGES/bitcoin.po
  2. 2
      share/uiproject.fbp
  3. 40
      src/bitcoinrpc.cpp
  4. 3
      src/init.cpp
  5. 5
      src/net.cpp
  6. 2
      src/uibase.cpp
  7. 3
      src/util.h

2
locale/nl/LC_MESSAGES/bitcoin.po

@ -448,7 +448,7 @@ msgstr "&Open Bitcoin"
#: ../../../src/ui.cpp:2682 #: ../../../src/ui.cpp:2682
msgid "&Send Bitcoins" msgid "&Send Bitcoins"
msgstr "&Open Bitcoin" msgstr "&Verstuur Bitcoins"
#: ../../../src/ui.cpp:2683 #: ../../../src/ui.cpp:2683
msgid "O&ptions..." msgid "O&ptions..."

2
share/uiproject.fbp

@ -2090,7 +2090,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">&amp;Connect through socks4 proxy: </property> <property name="label">&amp;Connect through socks4 proxy (requires restart to apply): </property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_checkBoxUseProxy</property> <property name="name">m_checkBoxUseProxy</property>

40
src/bitcoinrpc.cpp

@ -342,21 +342,19 @@ Value getnewaddress(const Array& params, bool fHelp)
strAccount = AccountFromValue(params[0]); strAccount = AccountFromValue(params[0]);
// Generate a new key that is added to wallet // Generate a new key that is added to wallet
string strAddress = CBitcoinAddress(pwalletMain->GetOrReuseKeyFromPool()).ToString(); CBitcoinAddress address(pwalletMain->GetOrReuseKeyFromPool());
// This could be done in the same main CS as GetKeyFromKeyPool. // This could be done in the same main CS as GetKeyFromKeyPool.
CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook) CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook)
pwalletMain->SetAddressBookName(strAddress, strAccount); pwalletMain->SetAddressBookName(address, strAccount);
return strAddress; return address.ToString();
} }
// requires cs_main, cs_mapWallet, cs_mapAddressBook locks // requires cs_main, cs_mapWallet, cs_mapAddressBook locks
CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false) CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false)
{ {
string strAddress;
CWalletDB walletdb(pwalletMain->strWalletFile); CWalletDB walletdb(pwalletMain->strWalletFile);
CAccount account; CAccount account;
@ -393,8 +391,7 @@ CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false)
else else
{ {
account.vchPubKey = pwalletMain->GetOrReuseKeyFromPool(); account.vchPubKey = pwalletMain->GetOrReuseKeyFromPool();
string strAddress = CBitcoinAddress(account.vchPubKey).ToString(); pwalletMain->SetAddressBookName(CBitcoinAddress(account.vchPubKey), strAccount);
pwalletMain->SetAddressBookName(strAddress, strAccount);
walletdb.WriteAccount(strAccount, account); walletdb.WriteAccount(strAccount, account);
} }
} }
@ -434,8 +431,7 @@ Value setaccount(const Array& params, bool fHelp)
"setaccount <bitcoinaddress> <account>\n" "setaccount <bitcoinaddress> <account>\n"
"Sets the account associated with the given address."); "Sets the account associated with the given address.");
string strAddress = params[0].get_str(); CBitcoinAddress address(params[0].get_str());
CBitcoinAddress address(strAddress);
if (!address.IsValid()) if (!address.IsValid())
throw JSONRPCError(-5, "Invalid bitcoin address"); throw JSONRPCError(-5, "Invalid bitcoin address");
@ -456,7 +452,7 @@ Value setaccount(const Array& params, bool fHelp)
GetAccountAddress(strOldAccount, true); GetAccountAddress(strOldAccount, true);
} }
pwalletMain->SetAddressBookName(strAddress, strAccount); pwalletMain->SetAddressBookName(address, strAccount);
} }
return Value::null; return Value::null;
@ -470,8 +466,9 @@ Value getaccount(const Array& params, bool fHelp)
"getaccount <bitcoinaddress>\n" "getaccount <bitcoinaddress>\n"
"Returns the account associated with the given address."); "Returns the account associated with the given address.");
string strAddress = params[0].get_str(); CBitcoinAddress address(params[0].get_str());
CBitcoinAddress address(strAddress); if (!address.IsValid())
throw JSONRPCError(-5, "Invalid bitcoin address");
string strAccount; string strAccount;
CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook) CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook)
@ -536,7 +533,9 @@ Value sendtoaddress(const Array& params, bool fHelp)
"sendtoaddress <bitcoinaddress> <amount> [comment] [comment-to]\n" "sendtoaddress <bitcoinaddress> <amount> [comment] [comment-to]\n"
"<amount> is a real and is rounded to the nearest 0.00000001"); "<amount> is a real and is rounded to the nearest 0.00000001");
string strAddress = params[0].get_str(); CBitcoinAddress address(params[0].get_str());
if (!address.IsValid())
throw JSONRPCError(-5, "Invalid bitcoin address");
// Amount // Amount
int64 nAmount = AmountFromValue(params[1]); int64 nAmount = AmountFromValue(params[1]);
@ -554,7 +553,7 @@ Value sendtoaddress(const Array& params, bool fHelp)
if(pwalletMain->IsLocked()) if(pwalletMain->IsLocked())
throw JSONRPCError(-14, "Error: The wallet passphrase entered was incorrect."); throw JSONRPCError(-14, "Error: The wallet passphrase entered was incorrect.");
string strError = pwalletMain->SendMoneyToBitcoinAddress(strAddress, nAmount, wtx); string strError = pwalletMain->SendMoneyToBitcoinAddress(address, nAmount, wtx);
if (strError != "") if (strError != "")
throw JSONRPCError(-4, strError); throw JSONRPCError(-4, strError);
} }
@ -807,7 +806,9 @@ Value sendfrom(const Array& params, bool fHelp)
"<amount> is a real and is rounded to the nearest 0.00000001"); "<amount> is a real and is rounded to the nearest 0.00000001");
string strAccount = AccountFromValue(params[0]); string strAccount = AccountFromValue(params[0]);
string strAddress = params[1].get_str(); CBitcoinAddress address(params[1].get_str());
if (!address.IsValid())
throw JSONRPCError(-5, "Invalid bitcoin address");
int64 nAmount = AmountFromValue(params[2]); int64 nAmount = AmountFromValue(params[2]);
int nMinDepth = 1; int nMinDepth = 1;
if (params.size() > 3) if (params.size() > 3)
@ -833,7 +834,7 @@ Value sendfrom(const Array& params, bool fHelp)
throw JSONRPCError(-6, "Account has insufficient funds"); throw JSONRPCError(-6, "Account has insufficient funds");
// Send // Send
string strError = pwalletMain->SendMoneyToBitcoinAddress(strAddress, nAmount, wtx); string strError = pwalletMain->SendMoneyToBitcoinAddress(address, nAmount, wtx);
if (strError != "") if (strError != "")
throw JSONRPCError(-4, strError); throw JSONRPCError(-4, strError);
} }
@ -1538,8 +1539,7 @@ Value validateaddress(const Array& params, bool fHelp)
"validateaddress <bitcoinaddress>\n" "validateaddress <bitcoinaddress>\n"
"Return information about <bitcoinaddress>."); "Return information about <bitcoinaddress>.");
string strAddress = params[0].get_str(); CBitcoinAddress address(params[0].get_str());
CBitcoinAddress address(strAddress);
bool isValid = address.IsValid(); bool isValid = address.IsValid();
Object ret; Object ret;
@ -1742,7 +1742,7 @@ string pAllowInSafeMode[] =
"getinfo", "getinfo",
"getnewaddress", "getnewaddress",
"getaccountaddress", "getaccountaddress",
"setlabel", "setlabel", // deprecated
"getaccount", "getaccount",
"getlabel", // deprecated "getlabel", // deprecated
"getaddressesbyaccount", "getaddressesbyaccount",
@ -2373,7 +2373,7 @@ int CommandLineRPC(int argc, char *argv[])
if (strMethod == "getreceivedbyaccount" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "getreceivedbyaccount" && n > 1) ConvertTo<boost::int64_t>(params[1]);
if (strMethod == "getreceivedbylabel" && n > 1) ConvertTo<boost::int64_t>(params[1]); // deprecated if (strMethod == "getreceivedbylabel" && n > 1) ConvertTo<boost::int64_t>(params[1]); // deprecated
if (strMethod == "getallreceived" && n > 0) ConvertTo<boost::int64_t>(params[0]); // deprecated if (strMethod == "getallreceived" && n > 0) ConvertTo<boost::int64_t>(params[0]); // deprecated
if (strMethod == "getallreceived" && n > 1) ConvertTo<bool>(params[1]); if (strMethod == "getallreceived" && n > 1) ConvertTo<bool>(params[1]); // deprecated
if (strMethod == "listreceivedbyaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "listreceivedbyaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]);
if (strMethod == "listreceivedbyaddress" && n > 1) ConvertTo<bool>(params[1]); if (strMethod == "listreceivedbyaddress" && n > 1) ConvertTo<bool>(params[1]);
if (strMethod == "listreceivedbyaccount" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "listreceivedbyaccount" && n > 0) ConvertTo<boost::int64_t>(params[0]);

3
src/init.cpp

@ -246,7 +246,8 @@ bool AppInit2(int argc, char* argv[])
fPrintToDebugger = GetBoolArg("-printtodebugger"); fPrintToDebugger = GetBoolArg("-printtodebugger");
fTestNet = GetBoolArg("-testnet"); fTestNet = GetBoolArg("-testnet");
fNoListen = GetBoolArg("-nolisten"); bool fTOR = (fUseProxy && addrProxy.port == htons(9050));
fNoListen = GetBoolArg("-nolisten") || fTOR;
fLogTimestamps = GetBoolArg("-logtimestamps"); fLogTimestamps = GetBoolArg("-logtimestamps");
for (int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)

5
src/net.cpp

@ -1092,13 +1092,14 @@ void ThreadMapPort2(void* parg)
{ {
char intClient[16]; char intClient[16];
char intPort[6]; char intPort[6];
string strDesc = "Bitcoin " + FormatFullVersion();
#ifndef __WXMSW__ #ifndef __WXMSW__
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
port, port, lanaddr, 0, "TCP", 0); port, port, lanaddr, strDesc.c_str(), "TCP", 0);
#else #else
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
port, port, lanaddr, 0, "TCP", 0, "0"); port, port, lanaddr, strDesc.c_str(), "TCP", 0, "0");
#endif #endif
if(r!=UPNPCOMMAND_SUCCESS) if(r!=UPNPCOMMAND_SUCCESS)
printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n", printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",

2
src/uibase.cpp

@ -367,7 +367,7 @@ COptionsDialogBase::COptionsDialogBase( wxWindow* parent, wxWindowID id, const w
wxBoxSizer* bSizer102; wxBoxSizer* bSizer102;
bSizer102 = new wxBoxSizer( wxHORIZONTAL ); bSizer102 = new wxBoxSizer( wxHORIZONTAL );
m_checkBoxUseProxy = new wxCheckBox( m_panelMain, wxID_ANY, _("&Connect through socks4 proxy: "), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxUseProxy = new wxCheckBox( m_panelMain, wxID_ANY, _("&Connect through socks4 proxy (requires restart to apply): "), wxDefaultPosition, wxDefaultSize, 0 );
bSizer102->Add( m_checkBoxUseProxy, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); bSizer102->Add( m_checkBoxUseProxy, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizer69->Add( bSizer102, 1, wxEXPAND, 5 ); bSizer69->Add( bSizer102, 1, wxEXPAND, 5 );

3
src/util.h

@ -621,7 +621,10 @@ inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=fa
return (pthread_t)0; return (pthread_t)0;
} }
if (!fWantHandle) if (!fWantHandle)
{
pthread_detach(hthread);
return (pthread_t)-1; return (pthread_t)-1;
}
return hthread; return hthread;
} }

Loading…
Cancel
Save