Commit graph

6108 commits

Author SHA1 Message Date
Stuart Cardall 7c8d9db4e4 SetupEnvironment() - clean commit 2014-07-09 17:01:36 +02:00
Pieter Wuille 20111387a7 Move base58.h implementation code to base58.cpp
Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
Rebased-From: f6b7c64
2014-07-09 16:36:24 +02:00
Ross Nicoll 937f65e9d1 Merge pull request #564 from langerhans/btc-0.9.2-batch-5
BTC 0.9.2 batch 5
2014-06-30 18:58:00 +01:00
Peter Todd d3fd2ce6b0 Fix script test handling of empty scripts
Previously an empty script would evaluate to OP_0
2014-06-29 16:15:37 +02:00
Wladimir J. van der Laan d3a1449294 rpc: keep track of acceptors, and cancel them in StopRPCThreads
Fixes #4156.

The problem is that the boost::asio::io_service destructor
waits for the acceptors to finish (on windows, and boost 1.55).

Fix this by keeping track of the acceptors and cancelling them before
stopping the event loops.
2014-06-29 16:05:47 +02:00
Philip Kaufmann ea4d67f3dc replace custom GetFilesize() with boost::filesystem::file_size() 2014-06-29 16:00:10 +02:00
Wladimir J. van der Laan 7e3dbfd248 rpc: keep track of acceptors 2014-06-29 15:38:48 +02:00
Wladimir J. van der Laan be18e2304e doc change, rpctimeout removed 2014-06-29 15:38:47 +02:00
Wladimir J. van der Laan 5d60b1829b rpc: Make sure conn object is always cleaned up
Make sure conn object always gets cleaned up by using a
`boost::shared_ptr`.

This makes valgrind happy - before this commit, one connection object
always leaked at shutdown, as well as can avoid other leaks, when
for example an exception happens.

Also add an explicit Close() to the !ClientAllowed path to make it similar
to the normal path (I'm not sure whether it is needed, but it
can't hurt).
2014-06-29 15:38:47 +02:00
Wladimir J. van der Laan 623ed78353 rpc: pass errors from async_accept
According to the [boost::asio documentation](http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference/basic_socket_acceptor/async_accept/overload2.html),
the function signature of the handler must be:

    void handler(
      const boost::system::error_code& error // Result of operation.
    );

We were binding *all* the arguments, instead of all but the error,
resulting in nullary function that never got the error. Fix this
by adding an input argument substitution.
2014-06-29 15:38:46 +02:00
shshshsh 876a2fb5b1 Switch stdout to line buffering
Use line buffering (instead of block buffering) so that messages arrive
immediately in systemd-journald, tail -f debug.log, and the like.

Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
Rebased-From: 283e405
2014-06-29 15:38:46 +02:00
Matthew Bogosian 79b0f61dd7 typo 2014-06-29 15:38:46 +02:00
Pieter Wuille 28c3a2080a Squashed 'src/leveldb/' changes from 9094c7f..7924331
42dcc7e Merge upstream LevelDB 1.17.
e353fbc Release LevelDB 1.17
269fc6c Release LevelDB 1.16
REVERT: 9094c7f Temporarily revert to writing .sst files instead of .ldb

git-subtree-dir: src/leveldb
git-subtree-split: 79243314e40ac31d79c68e5658a1d6a64800d50b
2014-06-29 15:38:45 +02:00
Wladimir J. van der Laan 82820e56be Add tests for BoostAsioToCNetAddr 2014-06-29 15:38:45 +02:00
Wladimir J. van der Laan 2d76e1f9df Remove unused function WildcardMatch
No longer necessary after implementing netmask-based matching.
Also remove a longer-unused function `skipspaces`.
2014-06-29 15:38:44 +02:00
Wladimir J. van der Laan dc43355203 rpc: Use netmasks instead of wildcards for IP address matching
`-rpcallowip` currently has a wacky wildcard-based format. After this
commit it will accept the more standard format, for example:

- Ranges with netmask 127.0.0.0/255.255.255.0, ::/0
- Ranges with cidr 12.3.4.5/24, 12:34:56:78:9a:bc:de:00/112
- Loose IPs ::1, 127.0.0.1

Trying to use the old *?-based format will result in an error message at
launch.
2014-06-29 15:38:44 +02:00
Wladimir J. van der Laan 407a7605dc net: Add CSubNet class for subnet matching 2014-06-29 15:38:44 +02:00
Wladimir J. van der Laan c1280fd3c2 Use new function parseint32 in SplitHostPort
Use the new function parseint32 in SplitHostPort instead of calling
strtol directly.
2014-06-29 15:38:43 +02:00
Wladimir J. van der Laan 6f4a1156dd util: add parseint32 function with strict error reporting
None of the current integer parsing functions in util
check whether the result is valid and fits in the range
of the type. This is required for less sloppy error reporting.
2014-06-29 15:38:43 +02:00
Pieter Wuille b108e2aae2 Add multiplication and division to uint160/uint256 2014-06-29 15:38:42 +02:00
Pieter Wuille eee99edaca Exception instead of assigning 0 in case of wrong vector length 2014-06-29 15:38:42 +02:00
Pieter Wuille 37d542abf5 Deduplicate shared code between uint160 and uint256 2014-06-29 15:38:42 +02:00
Wladimir J. van der Laan f5bfbdb649 Fix transaction tests
Conflict between low-s (6fd7ef2) and test updates in d3a33fc.
2014-06-29 15:38:41 +02:00
Pieter Wuille 4644e65561 Also switch the (unused) verification code to low-s instead of even-s.
a81cd968 introduced a malleability breaker for signatures
(using an even value for S). In e0e14e43 this was changed to
the lower of two potential values, rather than the even one.
Only the signing code was changed though, the (for now unused)
verification code wasn't adapted.
2014-06-29 15:38:41 +02:00
Peter Todd 50e3d3f3e1 Test CHECKMULTISIG with m == 0 and n == 0 2014-06-29 15:38:40 +02:00
harry 50a0dccaf0 build: fix: remove error output
while git not found in path, error is output to console.
2014-06-29 15:38:40 +02:00
Wladimir J. van der Laan 40ae77d46d qt: fix compile issue in Qt GUI
This was introduced in 3e1cf9b. Needs a cast to qint64.
2014-06-29 15:38:40 +02:00
David A. Harding 6944ca0e9a typos 2014-06-29 15:38:39 +02:00
Peter Todd edb4388c45 Check redeemScript size does not exceed 520 byte limit
redeemScripts >520bytes can't be spent due to the
MAX_SCRIPT_ELEMENT_SIZE limit; previously the addmultisigaddress and
createmultisig RPC calls would let you violate that limit unknowingly.

Also made the wallet code itself check the redeemScript prior to adding
it to the wallet, which in the (rare) instance that a user has added an
invalid oversized redeemScript to their wallet causes an error on
startup. The affected key isn't added to the wallet; other keys are
unaffected.
2014-06-29 15:38:39 +02:00
Peter Todd 688b776c45 Increase IsStandard() scriptSig length
Removes the limits on number of pubkeys for P2SH CHECKMULTISIG outputs.
Previously with the 500 byte scriptSig limit there were odd restrictions
where even a 1-of-12 P2SH could be spent in a standard transaction(1),
yet multisig scriptPubKey's requiring more signatures quickly ran out of
scriptSig space.

From a "stuff-data-in-the-blockchain" point of view not much has changed
as with the prior commit now only allowing the dummy value to be null
the newly allowed scriptSig space can only be used for signatures. In
any case, just using more outputs is trivial and doesn't cost much.

1) See 779b519480d8c5346de6e635119c7ee772e97ec872240c45e558f582a37b4b73
   Mined by BTC Guild.
2014-06-29 15:38:38 +02:00
Peter Todd b6faba6035 Do not trigger a DoS ban if SCRIPT_VERIFY_NULLDUMMY fails 2014-06-29 15:38:38 +02:00
Peter Todd ec389a30e5 Add rejection of non-null CHECKMULTISIG dummy values
This is a source of transaction mutability as the dummy value was
previously not checked and could be modified to something other than the
usual OP_0 value.
2014-06-29 15:38:38 +02:00
Philip Kaufmann f3e02f6acf typo 2014-06-29 15:38:37 +02:00
Wladimir J. van der Laan 72bd7b81f1 Add missing cs_main lock to VerifyDB
Fixes issue #4139.
2014-06-29 15:38:37 +02:00
Wladimir J. van der Laan 77c26ba357 ui: Check for !pixmap() before trying to export QR code
Adds null pointer checks as well as prevents the Save/Copy context
menu from appearing at all if no image is shown.

Fixes issue #4140
2014-06-29 15:38:36 +02:00
Philip Kaufmann 5c18e7b501 [Qt] fix Qt slot problem in receivecoinsdialog
- fixes error from debug.log:
  QMetaObject::connectSlotsByName: No matching signal for
  on_recentRequestsView_selectionChanged(QItemSelection,QItemSelection)
- small style fixes (e.g. alphabetical ordering if includes etc.)
- fixes #3992
2014-06-29 15:38:36 +02:00
Cory Fields ec6d399176 build: fix make clean on OSX
Rebased-From: 74df0f5
Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
2014-06-29 15:38:35 +02:00
Wladimir J. van der Laan a9b31d4dec l10n AGAIN 2014-06-29 15:38:35 +02:00
Wladimir J. van der Laan 72a22c18ff Remove NumBlocksOfPeers
Generally useless information. Only updates on connect time, not after
that. Peers can easily lie and the median filter is not effective in
preventing that.

In the past it was used for progress display in the GUI but
`CheckPoints::guessVerificationProgress` provides a better way that is now used.
It was too easy to mislead it. Peers do lie about it in practice, see issue #4065.

From the RPC, `getpeerinfo` gives the peer raw values, which are more
useful.
2014-06-29 15:38:34 +02:00
Wladimir J. van der Laan de74b47737 rpc: add getblockchaininfo and getnetworkinfo
Adds two new info query commands that take over information from
hodge-podge `getinfo`.

Also some new information is added:
- `getblockchaininfo`
  - `chain`: (string) current chain (main, testnet3, regtest)
  - `verificationprogress: (numeric) estimated verification progress
  - `chainwork`
- `getnetworkinfo`
  - `localaddresses`: (array) local addresses, from mapLocalHost (fixes #1734)
2014-06-29 15:38:33 +02:00
Philip Kaufmann 4f519b0dac add DEFAULT_TRANSACTION_FEE constant in wallet
- as this is a shared Core/GUI setting, this makes it easier to keep them
  in sync (also no new includes are needed)
2014-06-29 15:38:33 +02:00
Peter Todd 49d701e7aa Let tx (in)valid tests use any SCRIPT_VERIFY flag
Previously only P2SH could be set.
2014-06-29 15:38:33 +02:00
Peter Todd 1479d05a79 Create (MANDATORY|STANDARD)_SCRIPT_VERIFY_FLAGS constants 2014-06-29 15:38:32 +02:00
Wladimir J. van der Laan 0d328561ba Remove reference to libboost with specific version 2014-06-29 15:38:32 +02:00
Fabian Raetz 3622210fb2 Don't use ded -i to stay POSIX compliant 2014-06-29 15:38:31 +02:00
Fabian Raetz aa447d7139 reorder includes to compile on OpenBSD
From getifaddr(3) manual:
"If both <net/if.h> and <ifaddrs.h> are being
included, <net/if.h> must be included before <ifaddrs.h>"

http://www.openbsd.org/cgi-bin/man.cgi?query=getifaddrs&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html
2014-06-29 15:38:31 +02:00
Gavin Andresen 95aa920899 stop bitcoind/bitcoin-cli processes that might have been left running 2014-06-29 15:38:31 +02:00
Wladimir J. van der Laan 06aad6560c Use correct Qt tools in Gitian Linux build 2014-06-29 15:38:30 +02:00
Philip Kaufmann a6dea8846d Better std exception logging for CAddrDb 2014-06-29 15:38:30 +02:00
super3 889bd0fed5 Removed LevelDB changes
Syntax Highlighting
2014-06-29 15:38:29 +02:00