aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/bitcoind.bash-completion10
-rw-r--r--doc/build-osx.md16
-rwxr-xr-xqa/pull-tester/rpc-tests.sh5
-rw-r--r--qa/rpc-tests/util.py25
-rw-r--r--src/qt/macnotificationhandler.mm24
-rw-r--r--src/rest.cpp17
-rw-r--r--src/rpcclient.cpp1
-rw-r--r--src/rpcmisc.cpp20
-rw-r--r--src/rpcserver.cpp1
-rw-r--r--src/rpcserver.h1
10 files changed, 102 insertions, 18 deletions
diff --git a/contrib/bitcoind.bash-completion b/contrib/bitcoind.bash-completion
index 03ef173c09..37ece25899 100644
--- a/contrib/bitcoind.bash-completion
+++ b/contrib/bitcoind.bash-completion
@@ -39,6 +39,10 @@ _bitcoind() {
if ((cword > 4)); then
case ${words[cword-4]} in
+ listtransactions)
+ COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
+ return 0
+ ;;
signrawtransaction)
COMPREPLY=( $( compgen -W "ALL NONE SINGLE ALL|ANYONECANPAY NONE|ANYONECANPAY SINGLE|ANYONECANPAY" -- "$cur" ) )
return 0
@@ -52,7 +56,7 @@ _bitcoind() {
_bitcoin_accounts
return 0
;;
- gettxout|importprivkey)
+ getbalance|gettxout|importaddress|importprivkey|listreceivedbyaccount|listreceivedbyaddress|listsinceblock)
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
return 0
;;
@@ -65,7 +69,7 @@ _bitcoind() {
COMPREPLY=( $( compgen -W "add remove onetry" -- "$cur" ) )
return 0
;;
- getblock|getrawtransaction|listreceivedbyaccount|listreceivedbyaddress|sendrawtransaction)
+ getblock|getrawtransaction|gettransaction|listaccounts|listreceivedbyaccount|listreceivedbyaddress|sendrawtransaction)
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
return 0
;;
@@ -115,7 +119,7 @@ _bitcoind() {
# only parse help if senseful
if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then
- commands=$(_bitcoin_rpc help 2>/dev/null | awk '{ print $1; }')
+ commands=$(_bitcoin_rpc help 2>/dev/null | awk '$1 ~ /^[a-z]/ { print $1; }')
fi
COMPREPLY=( $( compgen -W "$helpopts $commands" -- "$cur" ) )
diff --git a/doc/build-osx.md b/doc/build-osx.md
index c79c1317b0..c41820f2b1 100644
--- a/doc/build-osx.md
+++ b/doc/build-osx.md
@@ -84,6 +84,22 @@ After exiting, you'll get a warning that the install is keg-only, which means it
make install
+Use Qt Creator as IDE
+------------------------
+You can use Qt Creator as IDE, for debugging and for manipulating forms, etc.
+Download Qt Creator from http://www.qt.io/download/. Download the "community edition" and only install Qt Creator (uncheck the rest during the installation process).
+
+1. Make sure you installed everything through homebrew mentioned above
+2. Do a proper ./configure --with-gui=qt5 --enable-debug
+3. In Qt Creator do "New Project" -> Import Project -> Import Existing Project
+4. Enter "bitcoin-qt" as project name, enter src/qt as location
+5. Leave the file selection as it is
+6. Confirm the "summary page"
+7. In the "Projects" tab select "Manage Kits..."
+8. Select the default "Desktop" kit and select "Clang (x86 64bit in /usr/bin)" as compiler
+9. Select LLDB as debugger (you might need to set the path to your installtion)
+10. Start debugging with Qt Creator
+
Creating a release build
------------------------
You can ignore this section if you are building `bitcoind` for your own use.
diff --git a/qa/pull-tester/rpc-tests.sh b/qa/pull-tester/rpc-tests.sh
index a0056c141b..0b5ad20642 100755
--- a/qa/pull-tester/rpc-tests.sh
+++ b/qa/pull-tester/rpc-tests.sh
@@ -8,6 +8,11 @@ CURDIR=$(cd $(dirname "$0"); pwd)
export BITCOINCLI=${BUILDDIR}/qa/pull-tester/run-bitcoin-cli
export BITCOIND=${REAL_BITCOIND}
+if [ "x${EXEEXT}" = "x.exe" ]; then
+ echo "Win tests currently disabled"
+ exit 0
+fi
+
#Run the tests
if [ "x${ENABLE_BITCOIND}${ENABLE_UTILS}${ENABLE_WALLET}" = "x111" ]; then
diff --git a/qa/rpc-tests/util.py b/qa/rpc-tests/util.py
index 0d5eeefa79..c6d918a81c 100644
--- a/qa/rpc-tests/util.py
+++ b/qa/rpc-tests/util.py
@@ -103,12 +103,17 @@ def initialize_chain(test_dir):
# Create a 200-block-long chain; each of the 4 nodes
# gets 25 mature blocks and 25 immature.
- for i in range(4):
- rpcs[i].setgenerate(True, 25)
- sync_blocks(rpcs)
- for i in range(4):
- rpcs[i].setgenerate(True, 25)
- sync_blocks(rpcs)
+ # blocks are created with timestamps 10 minutes apart, starting
+ # at 1 Jan 2014
+ block_time = 1388534400
+ for i in range(2):
+ for peer in range(4):
+ for j in range(25):
+ set_node_times(rpcs, block_time)
+ rpcs[peer].setgenerate(True, 1)
+ block_time += 10*60
+ # Must sync before next peer starts generating blocks
+ sync_blocks(rpcs)
# Shut them down, and clean up cache directories:
stop_nodes(rpcs)
@@ -179,10 +184,14 @@ def stop_node(node, i):
del bitcoind_processes[i]
def stop_nodes(nodes):
- for i in range(len(nodes)):
- nodes[i].stop()
+ for node in nodes:
+ node.stop()
del nodes[:] # Emptying array closes connections as a side effect
+def set_node_times(nodes, t):
+ for node in nodes:
+ node.setmocktime(t)
+
def wait_bitcoinds():
# Wait for all bitcoinds to cleanly exit
for bitcoind in bitcoind_processes.values():
diff --git a/src/qt/macnotificationhandler.mm b/src/qt/macnotificationhandler.mm
index 8a4c94cc5c..aa50a0d9fb 100644
--- a/src/qt/macnotificationhandler.mm
+++ b/src/qt/macnotificationhandler.mm
@@ -5,8 +5,21 @@
#include "macnotificationhandler.h"
#undef slots
+#import <objc/runtime.h>
#include <Cocoa/Cocoa.h>
+// Add an obj-c category (extension) to return the expected bundle identifier
+@implementation NSBundle(returnCorrectIdentifier)
+- (NSString *)__bundleIdentifier
+{
+ if (self == [NSBundle mainBundle]) {
+ return @"org.bitcoinfoundation.Bitcoin-Qt";
+ } else {
+ return [self __bundleIdentifier];
+ }
+}
+@end
+
void MacNotificationHandler::showNotification(const QString &title, const QString &text)
{
// check if users OS has support for NSUserNotification
@@ -63,7 +76,16 @@ bool MacNotificationHandler::hasUserNotificationCenterSupport(void)
MacNotificationHandler *MacNotificationHandler::instance()
{
static MacNotificationHandler *s_instance = NULL;
- if (!s_instance)
+ if (!s_instance) {
s_instance = new MacNotificationHandler();
+
+ Class aPossibleClass = objc_getClass("NSBundle");
+ if (aPossibleClass) {
+ // change NSBundle -bundleIdentifier method to return a correct bundle identifier
+ // a bundle identifier is required to use OSXs User Notification Center
+ method_exchangeImplementations(class_getInstanceMethod(aPossibleClass, @selector(bundleIdentifier)),
+ class_getInstanceMethod(aPossibleClass, @selector(__bundleIdentifier)));
+ }
+ }
return s_instance;
}
diff --git a/src/rest.cpp b/src/rest.cpp
index 89075887a0..9a8793a517 100644
--- a/src/rest.cpp
+++ b/src/rest.cpp
@@ -11,6 +11,7 @@
#include "core/transaction.h"
#include "version.h"
#include "main.h"
+#include "sync.h"
using namespace std;
using namespace json_spirit;
@@ -80,13 +81,17 @@ static bool rest_block(AcceptedConnection *conn,
if (!ParseHashStr(hashStr, hash))
throw RESTERR(HTTP_BAD_REQUEST, "Invalid hash: " + hashStr);
- if (mapBlockIndex.count(hash) == 0)
- throw RESTERR(HTTP_NOT_FOUND, hashStr + " not found");
-
CBlock block;
- CBlockIndex* pblockindex = mapBlockIndex[hash];
- if (!ReadBlockFromDisk(block, pblockindex))
- throw RESTERR(HTTP_NOT_FOUND, hashStr + " not found");
+ CBlockIndex* pblockindex = NULL;
+ {
+ LOCK(cs_main);
+ if (mapBlockIndex.count(hash) == 0)
+ throw RESTERR(HTTP_NOT_FOUND, hashStr + " not found");
+
+ pblockindex = mapBlockIndex[hash];
+ if (!ReadBlockFromDisk(block, pblockindex))
+ throw RESTERR(HTTP_NOT_FOUND, hashStr + " not found");
+ }
CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION);
ssBlock << block;
diff --git a/src/rpcclient.cpp b/src/rpcclient.cpp
index a9c491cede..7a1f1918f6 100644
--- a/src/rpcclient.cpp
+++ b/src/rpcclient.cpp
@@ -25,6 +25,7 @@ public:
static const CRPCConvertParam vRPCConvertParams[] =
{
{ "stop", 0 },
+ { "setmocktime", 0 },
{ "getaddednodeinfo", 0 },
{ "setgenerate", 0 },
{ "setgenerate", 1 },
diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp
index 08e956c961..31eaae6162 100644
--- a/src/rpcmisc.cpp
+++ b/src/rpcmisc.cpp
@@ -354,3 +354,23 @@ Value verifymessage(const Array& params, bool fHelp)
return (pubkey.GetID() == keyID);
}
+
+Value setmocktime(const Array& params, bool fHelp)
+{
+ if (fHelp || params.size() != 1)
+ throw runtime_error(
+ "setmocktime timestamp\n"
+ "\nSet the local time to given timestamp (-regtest only)\n"
+ "\nArguments:\n"
+ "1. timestamp (integer, required) Unix seconds-since-epoch timestamp\n"
+ " Pass 0 to go back to using the system time."
+ );
+
+ if (!Params().MineBlocksOnDemand())
+ throw runtime_error("setmocktime for regression testing (-regtest mode) only");
+
+ RPCTypeCheck(params, boost::assign::list_of(int_type));
+ SetMockTime(params[0].get_int64());
+
+ return Value::null;
+}
diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp
index 8b042e6003..01005c1cee 100644
--- a/src/rpcserver.cpp
+++ b/src/rpcserver.cpp
@@ -246,6 +246,7 @@ static const CRPCCommand vRPCCommands[] =
{ "control", "getinfo", &getinfo, true, false, false }, /* uses wallet if enabled */
{ "control", "help", &help, true, true, false },
{ "control", "stop", &stop, true, true, false },
+ { "control", "setmocktime", &setmocktime, true, false, false },
/* P2P networking */
{ "network", "getnetworkinfo", &getnetworkinfo, true, false, false },
diff --git a/src/rpcserver.h b/src/rpcserver.h
index 60793f79ae..b3234f65f2 100644
--- a/src/rpcserver.h
+++ b/src/rpcserver.h
@@ -194,6 +194,7 @@ extern json_spirit::Value getinfo(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getwalletinfo(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getblockchaininfo(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getnetworkinfo(const json_spirit::Array& params, bool fHelp);
+extern json_spirit::Value setmocktime(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getrawtransaction(const json_spirit::Array& params, bool fHelp); // in rcprawtransaction.cpp
extern json_spirit::Value listunspent(const json_spirit::Array& params, bool fHelp);