aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--contrib/debian/bitcoind.manpages1
-rw-r--r--contrib/debian/manpages/bitcoin-cli.148
-rw-r--r--src/Makefile.am3
-rw-r--r--src/key.cpp2
-rw-r--r--src/main.cpp22
-rw-r--r--src/net.h3
-rw-r--r--src/pubkey.cpp33
-rw-r--r--src/qt/forms/sendcoinsdialog.ui20
-rw-r--r--src/random.cpp7
-rw-r--r--src/rpcwallet.cpp27
11 files changed, 84 insertions, 83 deletions
diff --git a/configure.ac b/configure.ac
index 67a0cc28e5..f5bc1e3122 100644
--- a/configure.ac
+++ b/configure.ac
@@ -830,7 +830,6 @@ AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes])
AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno])
AM_CONDITIONAL([USE_COMPARISON_TOOL_REORG_TESTS],[test x$use_comparison_tool_reorg_test != xno])
AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes])
-AM_CONDITIONAL([USE_LIBSECP256K1],[test x$use_libsecp256k1 = xyes])
AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version])
diff --git a/contrib/debian/bitcoind.manpages b/contrib/debian/bitcoind.manpages
index 3e4ca63d4e..6d3e683855 100644
--- a/contrib/debian/bitcoind.manpages
+++ b/contrib/debian/bitcoind.manpages
@@ -1,2 +1,3 @@
debian/manpages/bitcoind.1
debian/manpages/bitcoin.conf.5
+debian/manpages/bitcoin-cli.1
diff --git a/contrib/debian/manpages/bitcoin-cli.1 b/contrib/debian/manpages/bitcoin-cli.1
new file mode 100644
index 0000000000..f953ae9db7
--- /dev/null
+++ b/contrib/debian/manpages/bitcoin-cli.1
@@ -0,0 +1,48 @@
+.TH BITCOIN-CLI "1" "February 2015" "bitcoin-cli 0.10"
+.SH NAME
+bitcoin-cli \- a remote procedure call client for Bitcoin Core.
+.SH SYNOPSIS
+bitcoin-cli [options] <command> [params] \- Send command to Bitcoin Core.
+.TP
+bitcoin-cli [options] help \- Asks Bitcoin Core for a list of supported commands.
+.SH DESCRIPTION
+This manual page documents the bitcoin-cli program. bitcoin-cli is an RPC client used to send commands to Bitcoin Core.
+
+.SH OPTIONS
+.TP
+\fB\-?\fR
+Show the help message.
+.TP
+\fB\-conf=\fR<file>
+Specify configuration file (default: bitcoin.conf).
+.TP
+\fB\-datadir=\fR<dir>
+Specify data directory.
+.TP
+\fB\-testnet\fR
+Connect to a Bitcoin Core instance running in testnet mode.
+.TP
+\fB\-regtest\fR
+Connect to a Bitcoin Core instance running in regtest mode (see documentation for -regtest on bitcoind).
+.TP
+\fB\-rpcuser=\fR<user>
+Username for JSON\-RPC connections.
+.TP
+\fB\-rpcpassword=\fR<pw>
+Password for JSON\-RPC connections.
+.TP
+\fB\-rpcport=\fR<port>
+Listen for JSON\-RPC connections on <port> (default: 8332 or testnet: 18332).
+.TP
+\fB\-rpcconnect=\fR<ip>
+Send commands to node running on <ip> (default: 127.0.0.1).
+.TP
+\fB\-rpcssl\fR=\fI1\fR
+Use OpenSSL (https) for JSON\-RPC connections (see the Bitcoin Wiki for SSL setup instructions).
+
+.SH "SEE ALSO"
+\fBbitcoind\fP, \fBbitcoin.conf\fP
+.SH AUTHOR
+This manual page was written by Ciemon Dunville <ciemon@gmail.com>. Permission is granted to copy, distribute and/or modify this document under the terms of the MIT License.
+
+The complete text of the MIT License can be found on the web at \fIhttp://opensource.org/licenses/MIT\fP.
diff --git a/src/Makefile.am b/src/Makefile.am
index 37dfd5dbaa..e1d467ff85 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -377,9 +377,6 @@ libbitcoinconsensus_la_LDFLAGS = -no-undefined $(RELDFLAGS)
libbitcoinconsensus_la_LIBADD = $(CRYPTO_LIBS)
libbitcoinconsensus_la_CPPFLAGS = $(CRYPTO_CFLAGS) -I$(builddir)/obj -DBUILD_BITCOIN_INTERNAL
-if USE_LIBSECP256K1
-libbitcoinconsensus_la_LIBADD += secp256k1/libsecp256k1.la
-endif
endif
#
diff --git a/src/key.cpp b/src/key.cpp
index d8319db1a3..64c9bc7119 100644
--- a/src/key.cpp
+++ b/src/key.cpp
@@ -208,11 +208,9 @@ void CExtKey::Decode(const unsigned char code[74]) {
}
bool ECC_InitSanityCheck() {
-#if !defined(USE_SECP256K1)
if (!CECKey::SanityCheck()) {
return false;
}
-#endif
CKey key;
key.MakeNewKey(true);
CPubKey pubkey = key.GetPubKey();
diff --git a/src/main.cpp b/src/main.cpp
index 34b4c51d5f..b6a61f7da1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3355,19 +3355,17 @@ void static ProcessGetData(CNode* pfrom)
BlockMap::iterator mi = mapBlockIndex.find(inv.hash);
if (mi != mapBlockIndex.end())
{
- // If the requested block is at a height below our last
- // checkpoint, only serve it if it's in the checkpointed chain
- int nHeight = mi->second->nHeight;
- CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint();
- if (pcheckpoint && nHeight < pcheckpoint->nHeight) {
- if (!chainActive.Contains(mi->second))
- {
- LogPrintf("ProcessGetData(): ignoring request for old block that isn't in the main chain\n");
- } else {
- send = true;
- }
- } else {
+ if (chainActive.Contains(mi->second)) {
send = true;
+ } else {
+ // To prevent fingerprinting attacks, only send blocks outside of the active
+ // chain if they are valid, and no more than a month older than the best header
+ // chain we know about.
+ send = mi->second->IsValid(BLOCK_VALID_SCRIPTS) && (pindexBestHeader != NULL) &&
+ (mi->second->GetBlockTime() > pindexBestHeader->GetBlockTime() - 30 * 24 * 60 * 60);
+ if (!send) {
+ LogPrintf("ProcessGetData(): ignoring request from peer=%i for old block that isn't in the main chain\n", pfrom->GetId());
+ }
}
}
if (send)
diff --git a/src/net.h b/src/net.h
index b78665b5c6..d2b2d88ddb 100644
--- a/src/net.h
+++ b/src/net.h
@@ -570,9 +570,6 @@ public:
}
}
- bool IsSubscribed(unsigned int nChannel);
- void Subscribe(unsigned int nChannel, unsigned int nHops=0);
- void CancelSubscribe(unsigned int nChannel);
void CloseSocketDisconnect();
// Denial-of-service detection/prevention
diff --git a/src/pubkey.cpp b/src/pubkey.cpp
index 3ae67ca5fe..a4c046bff5 100644
--- a/src/pubkey.cpp
+++ b/src/pubkey.cpp
@@ -6,25 +6,16 @@
#include "eccryptoverify.h"
-#ifdef USE_SECP256K1
-#include <secp256k1.h>
-#else
#include "ecwrapper.h"
-#endif
bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig) const {
if (!IsValid())
return false;
-#ifdef USE_SECP256K1
- if (secp256k1_ecdsa_verify((const unsigned char*)&hash, &vchSig[0], vchSig.size(), begin(), size()) != 1)
- return false;
-#else
CECKey key;
if (!key.SetPubKey(begin(), size()))
return false;
if (!key.Verify(hash, vchSig))
return false;
-#endif
return true;
}
@@ -33,52 +24,33 @@ bool CPubKey::RecoverCompact(const uint256 &hash, const std::vector<unsigned cha
return false;
int recid = (vchSig[0] - 27) & 3;
bool fComp = ((vchSig[0] - 27) & 4) != 0;
-#ifdef USE_SECP256K1
- int pubkeylen = 65;
- if (!secp256k1_ecdsa_recover_compact((const unsigned char*)&hash, &vchSig[1], (unsigned char*)begin(), &pubkeylen, fComp, recid))
- return false;
- assert((int)size() == pubkeylen);
-#else
CECKey key;
if (!key.Recover(hash, &vchSig[1], recid))
return false;
std::vector<unsigned char> pubkey;
key.GetPubKey(pubkey, fComp);
Set(pubkey.begin(), pubkey.end());
-#endif
return true;
}
bool CPubKey::IsFullyValid() const {
if (!IsValid())
return false;
-#ifdef USE_SECP256K1
- if (!secp256k1_ecdsa_pubkey_verify(begin(), size()))
- return false;
-#else
CECKey key;
if (!key.SetPubKey(begin(), size()))
return false;
-#endif
return true;
}
bool CPubKey::Decompress() {
if (!IsValid())
return false;
-#ifdef USE_SECP256K1
- int clen = size();
- int ret = secp256k1_ecdsa_pubkey_decompress((unsigned char*)begin(), &clen);
- assert(ret);
- assert(clen == (int)size());
-#else
CECKey key;
if (!key.SetPubKey(begin(), size()))
return false;
std::vector<unsigned char> pubkey;
key.GetPubKey(pubkey, false);
Set(pubkey.begin(), pubkey.end());
-#endif
return true;
}
@@ -89,17 +61,12 @@ bool CPubKey::Derive(CPubKey& pubkeyChild, unsigned char ccChild[32], unsigned i
unsigned char out[64];
BIP32Hash(cc, nChild, *begin(), begin()+1, out);
memcpy(ccChild, out+32, 32);
-#ifdef USE_SECP256K1
- pubkeyChild = *this;
- bool ret = secp256k1_ecdsa_pubkey_tweak_add((unsigned char*)pubkeyChild.begin(), pubkeyChild.size(), out);
-#else
CECKey key;
bool ret = key.SetPubKey(begin(), size());
ret &= key.TweakPublic(out);
std::vector<unsigned char> pubkey;
key.GetPubKey(pubkey, true);
pubkeyChild.Set(pubkey.begin(), pubkey.end());
-#endif
return ret;
}
diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui
index eebb459327..b1ed7a27b5 100644
--- a/src/qt/forms/sendcoinsdialog.ui
+++ b/src/qt/forms/sendcoinsdialog.ui
@@ -771,16 +771,6 @@
</property>
</widget>
</item>
- <item>
- <widget class="QPushButton" name="buttonMinimizeFee">
- <property name="toolTip">
- <string>collapse fee-settings</string>
- </property>
- <property name="text">
- <string>Minimize</string>
- </property>
- </widget>
- </item>
</layout>
</item>
<item>
@@ -811,6 +801,16 @@
</property>
</spacer>
</item>
+ <item>
+ <widget class="QPushButton" name="buttonMinimizeFee">
+ <property name="toolTip">
+ <string>collapse fee-settings</string>
+ </property>
+ <property name="text">
+ <string>Minimize</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
diff --git a/src/random.cpp b/src/random.cpp
index ae25bee1b7..0ba0de908d 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -47,15 +47,16 @@ void RandAddSeedPerfmon()
{
RandAddSeed();
+#ifdef WIN32
+ // Don't need this on Linux, OpenSSL automatically uses /dev/urandom
+ // Seed with the entire set of perfmon data
+
// This can take up to 2 seconds, so only do it every 10 minutes
static int64_t nLastPerfmon;
if (GetTime() < nLastPerfmon + 10 * 60)
return;
nLastPerfmon = GetTime();
-#ifdef WIN32
- // Don't need this on Linux, OpenSSL automatically uses /dev/urandom
- // Seed with the entire set of perfmon data
std::vector<unsigned char> vData(250000, 0);
long ret = 0;
unsigned long nSize = 0;
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp
index 1afc3c910e..d097b6a0fa 100644
--- a/src/rpcwallet.cpp
+++ b/src/rpcwallet.cpp
@@ -19,6 +19,7 @@
#include <stdint.h>
#include <boost/assign/list_of.hpp>
+
#include "json/json_spirit_utils.h"
#include "json/json_spirit_value.h"
@@ -316,35 +317,29 @@ Value getaddressesbyaccount(const Array& params, bool fHelp)
return ret;
}
-void SendMoney(const CTxDestination &address, CAmount nValue, CWalletTx& wtxNew)
+static void SendMoney(const CTxDestination &address, CAmount nValue, CWalletTx& wtxNew)
{
+ CAmount curBalance = pwalletMain->GetBalance();
+
// Check amount
if (nValue <= 0)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid amount");
- if (nValue > pwalletMain->GetBalance())
+ if (nValue > curBalance)
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds");
- string strError;
- if (pwalletMain->IsLocked())
- {
- strError = "Error: Wallet locked, unable to create transaction!";
- LogPrintf("SendMoney(): %s", strError);
- throw JSONRPCError(RPC_WALLET_ERROR, strError);
- }
-
// Parse Bitcoin address
CScript scriptPubKey = GetScriptForDestination(address);
// Create and send the transaction
CReserveKey reservekey(pwalletMain);
CAmount nFeeRequired;
- if (!pwalletMain->CreateTransaction(scriptPubKey, nValue, wtxNew, reservekey, nFeeRequired, strError))
- {
- if (nValue + nFeeRequired > pwalletMain->GetBalance())
- strError = strprintf("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!", FormatMoney(nFeeRequired));
- LogPrintf("SendMoney(): %s\n", strError);
- throw JSONRPCError(RPC_WALLET_ERROR, strError);
+ std::string strError;
+ if (!pwalletMain->CreateTransaction(scriptPubKey, nValue, wtxNew, reservekey, nFeeRequired, strError)) {
+ if (nValue + nFeeRequired > curBalance)
+ throw JSONRPCError(RPC_WALLET_ERROR, strprintf("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!", FormatMoney(nFeeRequired)));
+ else
+ throw JSONRPCError(RPC_WALLET_ERROR, strError);
}
if (!pwalletMain->CommitTransaction(wtxNew, reservekey))
throw JSONRPCError(RPC_WALLET_ERROR, "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.");