diff options
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | contrib/bitcoind.bash-completion | 40 | ||||
-rw-r--r-- | contrib/bitrpc/bitrpc.py | 480 | ||||
-rw-r--r-- | doc/build-unix.md | 2 | ||||
-rw-r--r-- | src/clientversion.h | 4 | ||||
-rw-r--r-- | src/init.cpp | 1 | ||||
-rw-r--r-- | src/main.h | 8 | ||||
-rw-r--r-- | src/net.cpp | 4 | ||||
-rw-r--r-- | src/qt/bitcoin.cpp | 4 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 3 | ||||
-rw-r--r-- | src/qt/clientmodel.cpp | 13 | ||||
-rw-r--r-- | src/qt/clientmodel.h | 10 | ||||
-rw-r--r-- | src/qt/coincontroldialog.cpp | 14 | ||||
-rw-r--r-- | src/qt/coincontroldialog.h | 28 | ||||
-rw-r--r-- | src/qt/forms/addressbookpage.ui | 6 | ||||
-rw-r--r-- | src/qt/forms/coincontroldialog.ui | 7 | ||||
-rw-r--r-- | src/qt/forms/sendcoinsdialog.ui | 12 | ||||
-rw-r--r-- | src/qt/intro.cpp | 2 | ||||
-rw-r--r-- | src/qt/rpcconsole.cpp | 9 | ||||
-rw-r--r-- | src/test/Makefile.am | 1 | ||||
-rw-r--r-- | src/test/main_tests.cpp | 20 | ||||
-rw-r--r-- | src/wallet.h | 4 |
22 files changed, 398 insertions, 278 deletions
diff --git a/configure.ac b/configure.ac index 6f7d8d19a6..7ce5f683ee 100644 --- a/configure.ac +++ b/configure.ac @@ -2,9 +2,9 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 9) -define(_CLIENT_VERSION_REVISION, 0) +define(_CLIENT_VERSION_REVISION, 99) define(_CLIENT_VERSION_BUILD, 0) -define(_CLIENT_VERSION_IS_RELEASE, true) +define(_CLIENT_VERSION_IS_RELEASE, false) define(_COPYRIGHT_YEAR, 2014) AC_INIT([Bitcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@bitcoin.org],[bitcoin]) AC_CONFIG_AUX_DIR([src/build-aux]) diff --git a/contrib/bitcoind.bash-completion b/contrib/bitcoind.bash-completion index dd6c1ce819..03ef173c09 100644 --- a/contrib/bitcoind.bash-completion +++ b/contrib/bitcoind.bash-completion @@ -1,5 +1,5 @@ -# bash programmable completion for bitcoind(1) -# Copyright (c) 2012 Christian von Roques <roques@mti.ag> +# bash programmable completion for bitcoind(1) and bitcoin-cli(1) +# Copyright (c) 2012,2014 Christian von Roques <roques@mti.ag> # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -37,9 +37,35 @@ _bitcoind() { COMPREPLY=() _get_comp_words_by_ref -n = cur prev words cword + if ((cword > 4)); then + case ${words[cword-4]} in + signrawtransaction) + COMPREPLY=( $( compgen -W "ALL NONE SINGLE ALL|ANYONECANPAY NONE|ANYONECANPAY SINGLE|ANYONECANPAY" -- "$cur" ) ) + return 0 + ;; + esac + fi + + if ((cword > 3)); then + case ${words[cword-3]} in + addmultisigaddress) + _bitcoin_accounts + return 0 + ;; + gettxout|importprivkey) + COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) + return 0 + ;; + esac + fi + if ((cword > 2)); then case ${words[cword-2]} in - listreceivedbyaccount|listreceivedbyaddress) + addnode) + COMPREPLY=( $( compgen -W "add remove onetry" -- "$cur" ) ) + return 0 + ;; + getblock|getrawtransaction|listreceivedbyaccount|listreceivedbyaddress|sendrawtransaction) COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) return 0 ;; @@ -51,11 +77,11 @@ _bitcoind() { fi case "$prev" in - backupwallet) + backupwallet|dumpwallet|importwallet) _filedir return 0 ;; - setgenerate) + getmempool|lockunspent|setgenerate) COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) return 0 ;; @@ -66,7 +92,7 @@ _bitcoind() { esac case "$cur" in - -conf=*|-pid=*|-rpcsslcertificatechainfile=*|-rpcsslprivatekeyfile=*) + -conf=*|-pid=*|-loadblock=*|-wallet=*|-rpcsslcertificatechainfile=*|-rpcsslprivatekeyfile=*) cur="${cur#*=}" _filedir return 0 @@ -103,7 +129,7 @@ _bitcoind() { esac } -complete -F _bitcoind bitcoind +complete -F _bitcoind bitcoind bitcoin-cli } # Local variables: diff --git a/contrib/bitrpc/bitrpc.py b/contrib/bitrpc/bitrpc.py index b02b299177..a840bc2020 100644 --- a/contrib/bitrpc/bitrpc.py +++ b/contrib/bitrpc/bitrpc.py @@ -10,315 +10,315 @@ rpcpass = "" if rpcpass == "": - access = ServiceProxy("http://127.0.0.1:8332") + access = ServiceProxy("http://127.0.0.1:8332") else: - access = ServiceProxy("http://"+rpcuser+":"+rpcpass+"@127.0.0.1:8332") + access = ServiceProxy("http://"+rpcuser+":"+rpcpass+"@127.0.0.1:8332") cmd = sys.argv[1].lower() if cmd == "backupwallet": - try: - path = raw_input("Enter destination path/filename: ") - print access.backupwallet(path) - except: - print "\n---An error occurred---\n" + try: + path = raw_input("Enter destination path/filename: ") + print access.backupwallet(path) + except: + print "\n---An error occurred---\n" elif cmd == "getaccount": - try: - addr = raw_input("Enter a Bitcoin address: ") - print access.getaccount(addr) - except: - print "\n---An error occurred---\n" + try: + addr = raw_input("Enter a Bitcoin address: ") + print access.getaccount(addr) + except: + print "\n---An error occurred---\n" elif cmd == "getaccountaddress": - try: - acct = raw_input("Enter an account name: ") - print access.getaccountaddress(acct) - except: - print "\n---An error occurred---\n" + try: + acct = raw_input("Enter an account name: ") + print access.getaccountaddress(acct) + except: + print "\n---An error occurred---\n" elif cmd == "getaddressesbyaccount": - try: - acct = raw_input("Enter an account name: ") - print access.getaddressesbyaccount(acct) - except: - print "\n---An error occurred---\n" + try: + acct = raw_input("Enter an account name: ") + print access.getaddressesbyaccount(acct) + except: + print "\n---An error occurred---\n" elif cmd == "getbalance": - try: - acct = raw_input("Enter an account (optional): ") - mc = raw_input("Minimum confirmations (optional): ") - try: - print access.getbalance(acct, mc) - except: - print access.getbalance() - except: - print "\n---An error occurred---\n" + try: + acct = raw_input("Enter an account (optional): ") + mc = raw_input("Minimum confirmations (optional): ") + try: + print access.getbalance(acct, mc) + except: + print access.getbalance() + except: + print "\n---An error occurred---\n" elif cmd == "getblockbycount": - try: - height = raw_input("Height: ") - print access.getblockbycount(height) - except: - print "\n---An error occurred---\n" + try: + height = raw_input("Height: ") + print access.getblockbycount(height) + except: + print "\n---An error occurred---\n" elif cmd == "getblockcount": - try: - print access.getblockcount() - except: - print "\n---An error occurred---\n" + try: + print access.getblockcount() + except: + print "\n---An error occurred---\n" elif cmd == "getblocknumber": - try: - print access.getblocknumber() - except: - print "\n---An error occurred---\n" + try: + print access.getblocknumber() + except: + print "\n---An error occurred---\n" elif cmd == "getconnectioncount": - try: - print access.getconnectioncount() - except: - print "\n---An error occurred---\n" + try: + print access.getconnectioncount() + except: + print "\n---An error occurred---\n" elif cmd == "getdifficulty": - try: - print access.getdifficulty() - except: - print "\n---An error occurred---\n" + try: + print access.getdifficulty() + except: + print "\n---An error occurred---\n" elif cmd == "getgenerate": - try: - print access.getgenerate() - except: - print "\n---An error occurred---\n" + try: + print access.getgenerate() + except: + print "\n---An error occurred---\n" elif cmd == "gethashespersec": - try: - print access.gethashespersec() - except: - print "\n---An error occurred---\n" + try: + print access.gethashespersec() + except: + print "\n---An error occurred---\n" elif cmd == "getinfo": - try: - print access.getinfo() - except: - print "\n---An error occurred---\n" + try: + print access.getinfo() + except: + print "\n---An error occurred---\n" elif cmd == "getnewaddress": - try: - acct = raw_input("Enter an account name: ") - try: - print access.getnewaddress(acct) - except: - print access.getnewaddress() - except: - print "\n---An error occurred---\n" + try: + acct = raw_input("Enter an account name: ") + try: + print access.getnewaddress(acct) + except: + print access.getnewaddress() + except: + print "\n---An error occurred---\n" elif cmd == "getreceivedbyaccount": - try: - acct = raw_input("Enter an account (optional): ") - mc = raw_input("Minimum confirmations (optional): ") - try: - print access.getreceivedbyaccount(acct, mc) - except: - print access.getreceivedbyaccount() - except: - print "\n---An error occurred---\n" + try: + acct = raw_input("Enter an account (optional): ") + mc = raw_input("Minimum confirmations (optional): ") + try: + print access.getreceivedbyaccount(acct, mc) + except: + print access.getreceivedbyaccount() + except: + print "\n---An error occurred---\n" elif cmd == "getreceivedbyaddress": - try: - addr = raw_input("Enter a Bitcoin address (optional): ") - mc = raw_input("Minimum confirmations (optional): ") - try: - print access.getreceivedbyaddress(addr, mc) - except: - print access.getreceivedbyaddress() - except: - print "\n---An error occurred---\n" + try: + addr = raw_input("Enter a Bitcoin address (optional): ") + mc = raw_input("Minimum confirmations (optional): ") + try: + print access.getreceivedbyaddress(addr, mc) + except: + print access.getreceivedbyaddress() + except: + print "\n---An error occurred---\n" elif cmd == "gettransaction": - try: - txid = raw_input("Enter a transaction ID: ") - print access.gettransaction(txid) - except: - print "\n---An error occurred---\n" + try: + txid = raw_input("Enter a transaction ID: ") + print access.gettransaction(txid) + except: + print "\n---An error occurred---\n" elif cmd == "getwork": - try: - data = raw_input("Data (optional): ") - try: - print access.gettransaction(data) - except: - print access.gettransaction() - except: - print "\n---An error occurred---\n" + try: + data = raw_input("Data (optional): ") + try: + print access.gettransaction(data) + except: + print access.gettransaction() + except: + print "\n---An error occurred---\n" elif cmd == "help": - try: - cmd = raw_input("Command (optional): ") - try: - print access.help(cmd) - except: - print access.help() - except: - print "\n---An error occurred---\n" + try: + cmd = raw_input("Command (optional): ") + try: + print access.help(cmd) + except: + print access.help() + except: + print "\n---An error occurred---\n" elif cmd == "listaccounts": - try: - mc = raw_input("Minimum confirmations (optional): ") - try: - print access.listaccounts(mc) - except: - print access.listaccounts() - except: - print "\n---An error occurred---\n" + try: + mc = raw_input("Minimum confirmations (optional): ") + try: + print access.listaccounts(mc) + except: + print access.listaccounts() + except: + print "\n---An error occurred---\n" elif cmd == "listreceivedbyaccount": - try: - mc = raw_input("Minimum confirmations (optional): ") - incemp = raw_input("Include empty? (true/false, optional): ") - try: - print access.listreceivedbyaccount(mc, incemp) - except: - print access.listreceivedbyaccount() - except: - print "\n---An error occurred---\n" + try: + mc = raw_input("Minimum confirmations (optional): ") + incemp = raw_input("Include empty? (true/false, optional): ") + try: + print access.listreceivedbyaccount(mc, incemp) + except: + print access.listreceivedbyaccount() + except: + print "\n---An error occurred---\n" elif cmd == "listreceivedbyaddress": - try: - mc = raw_input("Minimum confirmations (optional): ") - incemp = raw_input("Include empty? (true/false, optional): ") - try: - print access.listreceivedbyaddress(mc, incemp) - except: - print access.listreceivedbyaddress() - except: - print "\n---An error occurred---\n" + try: + mc = raw_input("Minimum confirmations (optional): ") + incemp = raw_input("Include empty? (true/false, optional): ") + try: + print access.listreceivedbyaddress(mc, incemp) + except: + print access.listreceivedbyaddress() + except: + print "\n---An error occurred---\n" elif cmd == "listtransactions": - try: - acct = raw_input("Account (optional): ") - count = raw_input("Number of transactions (optional): ") - frm = raw_input("Skip (optional):") - try: - print access.listtransactions(acct, count, frm) - except: - print access.listtransactions() - except: - print "\n---An error occurred---\n" + try: + acct = raw_input("Account (optional): ") + count = raw_input("Number of transactions (optional): ") + frm = raw_input("Skip (optional):") + try: + print access.listtransactions(acct, count, frm) + except: + print access.listtransactions() + except: + print "\n---An error occurred---\n" elif cmd == "move": - try: - frm = raw_input("From: ") - to = raw_input("To: ") - amt = raw_input("Amount:") - mc = raw_input("Minimum confirmations (optional): ") - comment = raw_input("Comment (optional): ") - try: - print access.move(frm, to, amt, mc, comment) - except: - print access.move(frm, to, amt) - except: - print "\n---An error occurred---\n" + try: + frm = raw_input("From: ") + to = raw_input("To: ") + amt = raw_input("Amount:") + mc = raw_input("Minimum confirmations (optional): ") + comment = raw_input("Comment (optional): ") + try: + print access.move(frm, to, amt, mc, comment) + except: + print access.move(frm, to, amt) + except: + print "\n---An error occurred---\n" elif cmd == "sendfrom": - try: - frm = raw_input("From: ") - to = raw_input("To: ") - amt = raw_input("Amount:") - mc = raw_input("Minimum confirmations (optional): ") - comment = raw_input("Comment (optional): ") - commentto = raw_input("Comment-to (optional): ") - try: - print access.sendfrom(frm, to, amt, mc, comment, commentto) - except: - print access.sendfrom(frm, to, amt) - except: - print "\n---An error occurred---\n" + try: + frm = raw_input("From: ") + to = raw_input("To: ") + amt = raw_input("Amount:") + mc = raw_input("Minimum confirmations (optional): ") + comment = raw_input("Comment (optional): ") + commentto = raw_input("Comment-to (optional): ") + try: + print access.sendfrom(frm, to, amt, mc, comment, commentto) + except: + print access.sendfrom(frm, to, amt) + except: + print "\n---An error occurred---\n" elif cmd == "sendmany": - try: - frm = raw_input("From: ") - to = raw_input("To (in format address1:amount1,address2:amount2,...): ") - mc = raw_input("Minimum confirmations (optional): ") - comment = raw_input("Comment (optional): ") - try: - print access.sendmany(frm,to,mc,comment) - except: - print access.sendmany(frm,to) - except: - print "\n---An error occurred---\n" + try: + frm = raw_input("From: ") + to = raw_input("To (in format address1:amount1,address2:amount2,...): ") + mc = raw_input("Minimum confirmations (optional): ") + comment = raw_input("Comment (optional): ") + try: + print access.sendmany(frm,to,mc,comment) + except: + print access.sendmany(frm,to) + except: + print "\n---An error occurred---\n" elif cmd == "sendtoaddress": - try: - to = raw_input("To (in format address1:amount1,address2:amount2,...): ") - amt = raw_input("Amount:") - comment = raw_input("Comment (optional): ") - commentto = raw_input("Comment-to (optional): ") - try: - print access.sendtoaddress(to,amt,comment,commentto) - except: - print access.sendtoaddress(to,amt) - except: - print "\n---An error occurred---\n" + try: + to = raw_input("To (in format address1:amount1,address2:amount2,...): ") + amt = raw_input("Amount:") + comment = raw_input("Comment (optional): ") + commentto = raw_input("Comment-to (optional): ") + try: + print access.sendtoaddress(to,amt,comment,commentto) + except: + print access.sendtoaddress(to,amt) + except: + print "\n---An error occurred---\n" elif cmd == "setaccount": - try: - addr = raw_input("Address: ") - acct = raw_input("Account:") - print access.setaccount(addr,acct) - except: - print "\n---An error occurred---\n" + try: + addr = raw_input("Address: ") + acct = raw_input("Account:") + print access.setaccount(addr,acct) + except: + print "\n---An error occurred---\n" elif cmd == "setgenerate": - try: - gen= raw_input("Generate? (true/false): ") - cpus = raw_input("Max processors/cores (-1 for unlimited, optional):") - try: - print access.setgenerate(gen, cpus) - except: - print access.setgenerate(gen) - except: - print "\n---An error occurred---\n" + try: + gen= raw_input("Generate? (true/false): ") + cpus = raw_input("Max processors/cores (-1 for unlimited, optional):") + try: + print access.setgenerate(gen, cpus) + except: + print access.setgenerate(gen) + except: + print "\n---An error occurred---\n" elif cmd == "settxfee": - try: - amt = raw_input("Amount:") - print access.settxfee(amt) - except: - print "\n---An error occurred---\n" + try: + amt = raw_input("Amount:") + print access.settxfee(amt) + except: + print "\n---An error occurred---\n" elif cmd == "stop": - try: - print access.stop() - except: - print "\n---An error occurred---\n" + try: + print access.stop() + except: + print "\n---An error occurred---\n" elif cmd == "validateaddress": - try: - addr = raw_input("Address: ") - print access.validateaddress(addr) - except: - print "\n---An error occurred---\n" + try: + addr = raw_input("Address: ") + print access.validateaddress(addr) + except: + print "\n---An error occurred---\n" elif cmd == "walletpassphrase": - try: - pwd = raw_input("Enter wallet passphrase: ") - access.walletpassphrase(pwd, 60) - print "\n---Wallet unlocked---\n" - except: - print "\n---An error occurred---\n" + try: + pwd = raw_input("Enter wallet passphrase: ") + access.walletpassphrase(pwd, 60) + print "\n---Wallet unlocked---\n" + except: + print "\n---An error occurred---\n" elif cmd == "walletpassphrasechange": - try: - pwd = raw_input("Enter old wallet passphrase: ") - pwd2 = raw_input("Enter new wallet passphrase: ") - access.walletpassphrasechange(pwd, pwd2) - print - print "\n---Passphrase changed---\n" - except: - print - print "\n---An error occurred---\n" - print + try: + pwd = raw_input("Enter old wallet passphrase: ") + pwd2 = raw_input("Enter new wallet passphrase: ") + access.walletpassphrasechange(pwd, pwd2) + print + print "\n---Passphrase changed---\n" + except: + print + print "\n---An error occurred---\n" + print else: - print "Command not found or not supported"
\ No newline at end of file + print "Command not found or not supported" diff --git a/doc/build-unix.md b/doc/build-unix.md index c11c0138a4..710070cb49 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -28,7 +28,7 @@ Dependencies http://miniupnp.tuxfamily.org/files/). UPnP support is compiled in and turned off by default. See the configure options for upnp behavior desired: - --with-miniupnpc No UPnP support miniupnp not required + --without-miniupnpc No UPnP support miniupnp not required --disable-upnp-default (the default) UPnP support turned off by default at runtime --enable-upnp-default UPnP support turned on by default at runtime diff --git a/src/clientversion.h b/src/clientversion.h index 3c69e028b5..8d0f89c715 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -12,10 +12,10 @@ #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 9 #define CLIENT_VERSION_REVISION 0 -#define CLIENT_VERSION_BUILD 0 +#define CLIENT_VERSION_BUILD 99 // Set to true for release, false for prerelease or test build -#define CLIENT_VERSION_IS_RELEASE true +#define CLIENT_VERSION_IS_RELEASE false // Copyright year (2009-this) // Todo: update this when changing our copyright comments in the source diff --git a/src/init.cpp b/src/init.cpp index 4cc18800a5..372f5db297 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -593,6 +593,7 @@ bool AppInit2(boost::thread_group& threadGroup) // ********************************************************* Step 5: verify wallet database integrity #ifdef ENABLE_WALLET if (!fDisableWallet) { + LogPrintf("Using wallet %s\n", strWalletFile); uiInterface.InitMessage(_("Verifying wallet...")); if (!bitdb.Open(GetDataDir())) diff --git a/src/main.h b/src/main.h index 781562854f..cc1786d0a6 100644 --- a/src/main.h +++ b/src/main.h @@ -266,10 +266,10 @@ int64_t GetMinFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree, // DUP CHECKSIG DROP ... repeated 100 times... OP_1 // - /** Check for standard transaction types - @param[in] mapInputs Map of previous transactions that have outputs we're spending - @return True if all inputs (scriptSigs) use only standard transaction forms - */ +/** Check for standard transaction types + @param[in] mapInputs Map of previous transactions that have outputs we're spending + @return True if all inputs (scriptSigs) use only standard transaction forms +*/ bool AreInputsStandard(const CTransaction& tx, CCoinsViewCache& mapInputs); /** Count ECDSA signature operations the old-fashioned (pre-0.6) way diff --git a/src/net.cpp b/src/net.cpp index bb1d1bac45..19f4a73bc4 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1653,7 +1653,7 @@ bool BindListenPort(const CService &addrBind, string& strError) { int nErr = WSAGetLastError(); if (nErr == WSAEADDRINUSE) - strError = strprintf(_("Unable to bind to %s on this computer. Bitcoin is probably already running."), addrBind.ToString()); + strError = strprintf(_("Unable to bind to %s on this computer. Bitcoin Core Daemon is probably already running."), addrBind.ToString()); else strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %d, %s)"), addrBind.ToString(), nErr, strerror(nErr)); LogPrintf("%s\n", strError); @@ -1664,7 +1664,7 @@ bool BindListenPort(const CService &addrBind, string& strError) // Listen for incoming connections if (listen(hListenSocket, SOMAXCONN) == SOCKET_ERROR) { - strError = strprintf("Error: Listening for incoming connections failed (listen returned error %d)", WSAGetLastError()); + strError = strprintf(_("Error: Listening for incoming connections failed (listen returned error %d)"), WSAGetLastError()); LogPrintf("%s\n", strError); return false; } diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 162009f5de..652d39a5ce 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -448,12 +448,12 @@ int main(int argc, char *argv[]) fSelParFromCLFailed = true; } #ifdef ENABLE_WALLET - // Parse URIs on command line -- this can affect TestNet() / RegTest() mode + // Parse URIs on command line -- this can affect Params() if (!PaymentServer::ipcParseCommandLine(argc, argv)) exit(0); #endif - bool isaTestNet = TestNet() || RegTest(); + bool isaTestNet = Params().NetworkID() != CChainParams::MAIN; // Do not refer to data directory yet, this can be overridden by Intro::pickDataDirectory diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index f66fab496c..0ca16edb8c 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -151,8 +151,7 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) : // Status bar notification icons QFrame *frameBlocks = new QFrame(); frameBlocks->setContentsMargins(0,0,0,0); - frameBlocks->setMinimumWidth(56); - frameBlocks->setMaximumWidth(56); + frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks); frameBlocksLayout->setContentsMargins(3,0,3,0); frameBlocksLayout->setSpacing(3); diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index f273b9ea46..cb832fdd42 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -39,9 +39,18 @@ ClientModel::~ClientModel() unsubscribeFromCoreSignals(); } -int ClientModel::getNumConnections() const +int ClientModel::getNumConnections(unsigned int flags) const { - return vNodes.size(); + LOCK(cs_vNodes); + if (flags == CONNECTIONS_ALL) // Shortcut if we want total + return vNodes.size(); + + int nNum = 0; + BOOST_FOREACH(CNode* pnode, vNodes) + if (flags & (pnode->fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT)) + nNum++; + + return nNum; } int ClientModel::getNumBlocks() const diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index ca735f14ce..f29b695ea1 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -25,6 +25,13 @@ enum BlockSource { BLOCK_SOURCE_NETWORK }; +enum NumConnections { + CONNECTIONS_NONE = 0, + CONNECTIONS_IN = (1U << 0), + CONNECTIONS_OUT = (1U << 1), + CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT), +}; + /** Model for Bitcoin network client. */ class ClientModel : public QObject { @@ -36,7 +43,8 @@ public: OptionsModel *getOptionsModel(); - int getNumConnections() const; + //! Return number of connections, default is in- and outbound (total) + int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const; int getNumBlocks() const; int getNumBlocksAtStartup(); diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 2d8fcd7a52..1e5a2efc94 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -125,6 +125,7 @@ CoinControlDialog::CoinControlDialog(QWidget *parent) : ui->treeWidget->setColumnHidden(COLUMN_VOUT_INDEX, true); // store vout index in this column, but dont show it ui->treeWidget->setColumnHidden(COLUMN_AMOUNT_INT64, true); // store amount int64 in this column, but dont show it ui->treeWidget->setColumnHidden(COLUMN_PRIORITY_INT64, true); // store priority int64 in this column, but dont show it + ui->treeWidget->setColumnHidden(COLUMN_DATE_INT64, true); // store date int64 in this column, but dont show it // default view is sorted by amount desc sortView(COLUMN_AMOUNT_INT64, Qt::DescendingOrder); @@ -327,7 +328,7 @@ void CoinControlDialog::sortView(int column, Qt::SortOrder order) sortColumn = column; sortOrder = order; ui->treeWidget->sortItems(column, order); - ui->treeWidget->header()->setSortIndicator((sortColumn == COLUMN_AMOUNT_INT64 ? COLUMN_AMOUNT : (sortColumn == COLUMN_PRIORITY_INT64 ? COLUMN_PRIORITY : sortColumn)), sortOrder); + ui->treeWidget->header()->setSortIndicator(getMappedColumn(sortColumn), sortOrder); } // treeview: clicked on header @@ -335,22 +336,18 @@ void CoinControlDialog::headerSectionClicked(int logicalIndex) { if (logicalIndex == COLUMN_CHECKBOX) // click on most left column -> do nothing { - ui->treeWidget->header()->setSortIndicator((sortColumn == COLUMN_AMOUNT_INT64 ? COLUMN_AMOUNT : (sortColumn == COLUMN_PRIORITY_INT64 ? COLUMN_PRIORITY : sortColumn)), sortOrder); + ui->treeWidget->header()->setSortIndicator(getMappedColumn(sortColumn), sortOrder); } else { - if (logicalIndex == COLUMN_AMOUNT) // sort by amount - logicalIndex = COLUMN_AMOUNT_INT64; - - if (logicalIndex == COLUMN_PRIORITY) // sort by priority - logicalIndex = COLUMN_PRIORITY_INT64; + logicalIndex = getMappedColumn(logicalIndex, false); if (sortColumn == logicalIndex) sortOrder = ((sortOrder == Qt::AscendingOrder) ? Qt::DescendingOrder : Qt::AscendingOrder); else { sortColumn = logicalIndex; - sortOrder = ((sortColumn == COLUMN_AMOUNT_INT64 || sortColumn == COLUMN_PRIORITY_INT64 || sortColumn == COLUMN_DATE || sortColumn == COLUMN_CONFIRMATIONS) ? Qt::DescendingOrder : Qt::AscendingOrder); // if amount,date,conf,priority then default => desc, else default => asc + sortOrder = ((sortColumn == COLUMN_LABEL || sortColumn == COLUMN_ADDRESS) ? Qt::AscendingOrder : Qt::DescendingOrder); // if label or address then default => asc, else default => desc } sortView(sortColumn, sortOrder); @@ -731,6 +728,7 @@ void CoinControlDialog::updateView() // date itemOutput->setText(COLUMN_DATE, GUIUtil::dateTimeStr(out.tx->GetTxTime())); + itemOutput->setText(COLUMN_DATE_INT64, strPad(QString::number(out.tx->GetTxTime()), 20, " ")); // confirmations itemOutput->setText(COLUMN_CONFIRMATIONS, strPad(QString::number(out.nDepth), 8, " ")); diff --git a/src/qt/coincontroldialog.h b/src/qt/coincontroldialog.h index b9318ca7b0..465e2a009d 100644 --- a/src/qt/coincontroldialog.h +++ b/src/qt/coincontroldialog.h @@ -65,9 +65,35 @@ private: COLUMN_TXHASH, COLUMN_VOUT_INDEX, COLUMN_AMOUNT_INT64, - COLUMN_PRIORITY_INT64 + COLUMN_PRIORITY_INT64, + COLUMN_DATE_INT64 }; + // some columns have a hidden column containing the value used for sorting + int getMappedColumn(int column, bool fVisibleColumn = true) + { + if (fVisibleColumn) + { + if (column == COLUMN_AMOUNT_INT64) + return COLUMN_AMOUNT; + else if (column == COLUMN_PRIORITY_INT64) + return COLUMN_PRIORITY; + else if (column == COLUMN_DATE_INT64) + return COLUMN_DATE; + } + else + { + if (column == COLUMN_AMOUNT) + return COLUMN_AMOUNT_INT64; + else if (column == COLUMN_PRIORITY) + return COLUMN_PRIORITY_INT64; + else if (column == COLUMN_DATE) + return COLUMN_DATE_INT64; + } + + return column; + } + private slots: void showMenu(const QPoint &); void copyAmount(); diff --git a/src/qt/forms/addressbookpage.ui b/src/qt/forms/addressbookpage.ui index 49221f41c1..f40c446050 100644 --- a/src/qt/forms/addressbookpage.ui +++ b/src/qt/forms/addressbookpage.ui @@ -122,6 +122,12 @@ </item> <item> <widget class="QPushButton" name="closeButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> <string>C&lose</string> </property> diff --git a/src/qt/forms/coincontroldialog.ui b/src/qt/forms/coincontroldialog.ui index a31c491e95..cd1c0ffa18 100644 --- a/src/qt/forms/coincontroldialog.ui +++ b/src/qt/forms/coincontroldialog.ui @@ -428,7 +428,7 @@ <bool>false</bool> </property> <property name="columnCount"> - <number>11</number> + <number>12</number> </property> <attribute name="headerShowSortIndicator" stdset="0"> <bool>true</bool> @@ -494,6 +494,11 @@ <string/> </property> </column> + <column> + <property name="text"> + <string/> + </property> + </column> </widget> </item> <item> diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 95f3294adb..4cb1670c79 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -742,6 +742,12 @@ </property> <item> <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> <string>Balance:</string> </property> @@ -749,6 +755,12 @@ </item> <item> <widget class="QLabel" name="labelBalance"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> </property> diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index fc1258827e..42833a8a33 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -14,7 +14,7 @@ /* Minimum free space (in bytes) needed for data directory */ static const uint64_t GB_BYTES = 1000000000LL; -static const uint64_t BLOCK_CHAIN_SIZE = 10LL * GB_BYTES; +static const uint64_t BLOCK_CHAIN_SIZE = 20LL * GB_BYTES; /* Check free space asynchronously to prevent hanging the UI thread. diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index bd29efee86..cb5991adf1 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -349,7 +349,14 @@ void RPCConsole::message(int category, const QString &message, bool html) void RPCConsole::setNumConnections(int count) { - ui->numberOfConnections->setText(QString::number(count)); + if (!clientModel) + return; + + QString connections = QString::number(count) + " ("; + connections += tr("In:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_IN)) + " / "; + connections += tr("Out:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_OUT)) + ")"; + + ui->numberOfConnections->setText(connections); } void RPCConsole::setNumBlocks(int count, int countOfPeers) diff --git a/src/test/Makefile.am b/src/test/Makefile.am index 667e53c6b4..5a1f42ee61 100644 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@ -45,6 +45,7 @@ test_bitcoin_SOURCES = \ DoS_tests.cpp \ getarg_tests.cpp \ key_tests.cpp \ + main_tests.cpp \ miner_tests.cpp \ mruset_tests.cpp \ multisig_tests.cpp \ diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp new file mode 100644 index 0000000000..b7f4312cda --- /dev/null +++ b/src/test/main_tests.cpp @@ -0,0 +1,20 @@ +#include "core.h" +#include "main.h" + +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_SUITE(main_tests) + +BOOST_AUTO_TEST_CASE(subsidy_limit_test) +{ + uint64_t nSum = 0; + for (int nHeight = 0; nHeight < 7000000; nHeight += 1000) { + uint64_t nSubsidy = GetBlockValue(nHeight, 0); + BOOST_CHECK(nSubsidy <= 50 * COIN); + nSum += nSubsidy * 1000; + BOOST_CHECK(MoneyRange(nSum)); + } + BOOST_CHECK(nSum == 2099999997690000ULL); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/wallet.h b/src/wallet.h index 7feb86d294..e2e89fffe7 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -675,8 +675,10 @@ public: { // Transactions not sent by us: not trusted const CWalletTx* parent = pwallet->GetWalletTx(txin.prevout.hash); + if (parent == NULL) + return false; const CTxOut& parentOut = parent->vout[txin.prevout.n]; - if (parent == NULL || !pwallet->IsMine(parentOut)) + if (!pwallet->IsMine(parentOut)) return false; } return true; |