Commit graph

144 commits

Author SHA1 Message Date
Gavin Andresen
ad9e86dca1
Keep mempool consistent during block-reorgs
This fixes a subtle bug involving block re-orgs and non-standard transactions.

Start with a block containing a non-standard transaction, and
one or more transactions spending it in the memory pool.

Then re-org away from that block to another chain that does
not contain the non-standard transaction.

Result before this fix: the dependent transactions get stuck
in the mempool without their parent, putting the mempool
in an inconsistent state.

Tested with a new unit test.
2015-03-26 11:58:19 -04:00
Jonas Schnelli
50c72f23ad [Move Only] Move wallet related things to src/wallet/
could once be renamed from /src/wallet to /src/legacywallet.
2015-03-12 14:13:02 +01:00
Wladimir J. van der Laan
cdae53e456
Merge pull request #5852
51598b2 Reinitialize state in between individual unit tests. (Pieter Wuille)
2015-03-09 12:51:07 +01:00
Pieter Wuille
51598b2631 Reinitialize state in between individual unit tests.
This changes the TestingSetup fixture to be per-unit-test rather than global.
Most tests don't need it, so it's only invoked in a few.
2015-03-03 09:01:46 -08:00
Ross Nicoll
34e5015cd2
Add unit tests for next difficulty calculations
Split GetNextWorkRequired() into two functions to allow the difficulty calculations to
be tested without requiring a full blockchain.
Add unit tests to cover basic difficulty calculation, plus each of the min/max actual
time, and maximum difficulty target conditions.
2015-02-21 13:14:19 +00:00
Manuel Araoz
d6bed1514c remove sig_canonical.json and sig_noncanonical.json 2015-01-31 17:36:44 -05:00
Cory Fields
d58c5d6f21 tests: run sanity checks in tests too
If these are going to fail in bitcoind, they should fail in the tests as well.
2015-01-05 22:34:47 -05:00
Wladimir J. van der Laan
dba2e9141a Add tests for new uint256 2015-01-05 15:45:35 +01:00
Wladimir J. van der Laan
bfc6070342 uint256->arith_uint256 blob256->uint256
Introduce new opaque implementation of `uint256`, move old
"arithmetic" implementation to `arith_uint256.
2015-01-05 15:45:35 +01:00
Jeff Garzik
39d6b5fd42
Merge #5528 from
branch 'bitcoin-tx-copy-paste' of git://github.com/ers35/bitcoin into merge-5528
2014-12-31 08:57:55 -05:00
Eric R. Schulz
2c14d1532f bitcoin-tx: Add test case for signing a tx 2014-12-24 01:56:28 +00:00
Cory Fields
be43492945 build: fix 'make distcheck'
Rather than treating the .py as a regular built test, run it from check-local
so that we can better control the paths used.
2014-12-19 18:04:12 -05:00
Cory Fields
f618577029 build: fix link error on some platforms. Fixes #5235
Some users may have libtool libs (.la) installed in their linker search paths.
In this case, using -static-libtool-libs would try to link in .a's instead of
shared libs. That would be harmless unless the .a was built in a way that
would break linking, like non-fpic.

What we really want is "-static" here. Despite its name, it's actually less
aggressive than -static-libtool-libs. It causes only internal libs to be linked
statically (libbitcoinconsensus is the one were'a after).
2014-11-20 13:45:14 -05:00
Cory Fields
cdd36c6c5c build: add --with-libs so that libs are optional 2014-11-19 22:31:10 -05:00
Cory Fields
2cf5f16c25 build: add libbitcoinconsensus files and hook up the lib build
Credit BlueMatt for libbitcoinsonsensus.h/cpp
2014-11-19 22:31:10 -05:00
Cory Fields
e0077de5de build: make a distinction between static app ldflags and static lib ldflags
For windows builds, exe's are always static, but libs should still conform to
--enabled-shared and --enable-static.
2014-11-19 22:08:27 -05:00
Cory Fields
4300876c81 build: secp256k1 as a subdir, since it's required 2014-11-18 18:06:47 +01:00
Pieter Wuille
07a9901703 Always build and link libsecp256k1 2014-11-18 18:06:46 +01:00
Philip Kaufmann
771d500283 minor cleanup: include orders, end comments etc.
- no code changes
2014-10-31 09:41:15 +01:00
Cory Fields
28d412ff20 build: quit abusing LIBS for Windows builds.
Similar to the INCLUDES changes in 6b099402b4, split out LIBS into individual
entries for more fine-grained control.

Also add MINIUPNPC_LIBS which was missing before, and hook it up to
executables.
2014-10-13 21:21:27 -04:00
Pieter Wuille
9df9cf5a9f Make SCRIPT_VERIFY_STRICTENC compatible with BIP62
* Delete canonical_tests.cpp, and move the tests to script_tests.cpp.
* Split off SCRIPT_VERIFY_DERSIG from SCRIPT_VERIFY_STRICTENC (the BIP62 part of it).
* Change signature STRICTENC/DERSIG semantics to fail the script entirely rather than the CHECKSIG result (softfork safety, and BIP62 requirement).
* Add many autogenerated tests for several odd cases.
* Mention specific BIP62 rules in the script verification flags.
2014-10-08 15:42:29 -07:00
Pieter Wuille
ed27e53c9b Add coins_tests with a large randomized CCoinViewCache test. 2014-09-23 22:29:45 +02:00
Luke Dashjr
a65e320747 bitcoin-util-test: Test bitcoin-tx with null scriptPubKey 2014-09-14 06:28:22 +00:00
Wladimir J. van der Laan
d1e26d4e71 Move CMedianFilter to timedata.cpp
Now that we no longer use the median filter to keep track of
the number of blocks of peers, that's the only place it is used.
2014-08-26 13:25:20 +02:00
Jeff Garzik
fac54dcb71
Merge pull request #4733 2014-08-22 10:35:39 -04:00
Jeff Garzik
e85267be63 UniValue: add unit tests 2014-08-20 00:28:46 -04:00
Jeff Garzik
df4d61e681 Add bitcoin-tx tests
Testing: delin, delout, locktime, and basic createrawtransaction-like
functionality.
2014-08-19 23:15:58 -04:00
Jeff Garzik
d789386371 Add "it works" test for bitcoin-tx 2014-08-19 10:28:58 -04:00
Cory Fields
e432a5f08d build: add option for reducing exports (v2)
This was committed previously as 4975ae172 and reverted, because the flags were
applied even if the checks didn't pass. This is the same commit, fixed up to
actually disable the functionality when necessary.

Enabled automatically if boost >= 1.49.
See: https://svn.boost.org/trac/boost/ticket/2309

Also, check for a default visibility attribute, so that we can mark future
api functions correctly.
2014-08-18 16:10:15 -04:00
Wladimir J. van der Laan
fad23a210b
Revert "build: add option for reducing exports"
Revert #4663 for now. It still breaks the pulltester.

This reverts commit 4975ae1722.

Conflicts:
	configure.ac
2014-08-18 16:52:56 +02:00
Cory Fields
4975ae1722 build: add option for reducing exports
Enabled automatically if boost >= 1.49.
See: https://svn.boost.org/trac/boost/ticket/2309

Also, check for a default visibility attribute, so that we can mark future
api functions correctly.
2014-08-15 17:42:53 -04:00
Cory Fields
6b099402b4
build: fix automake warnings about the use of INCLUDES
While we're at it, reduce the use of LIBS as well. This makes dependencies
explicit.

Fixes building with (the not-yet-merged) libsecp256k1 as well.

Github-Pull: #4689
Rebased-By: Wladimir J. van der laan <laanwj@gmail.com>
Rebased-From: 909b347 c0e5dda
2014-08-15 10:42:10 +02:00
Jeff Garzik
cbe39a3852 Add "bitcoin-tx" command line utility and supporting modules.
This is a simple utility that provides command line manipulation of
a hex-encoded TX. The utility takes a hex string on the command line
as input, performs zero or more mutations, and outputs a hex string
to standard output.

This utility is also an intentional exercise of the "bitcoin library"
concept. It is designed to require minimal libraries, and works
entirely without need for any RPC or P2P communication.

See "bitcoin-tx --help" for command and options summary.
2014-07-29 11:13:27 -04:00
Cory Fields
5566826635 secp256k1: Add build-side changes for libsecp256k1
Note: This is added to our existing automake targets rather than as a
libtool-style lib. The switch to libtool-style targets can come later if it
proves to not add any complications.
2014-07-01 12:27:19 -04:00
Pieter Wuille
236982c2b6 Add skiplist unit tests 2014-06-29 21:51:55 +02:00
Wladimir J. van der Laan
84ce18ca93 Remove unnecessary dependencies for bitcoin-cli
This commit removes all the unnecessary dependencies (key, core,
netbase, sync, ...) from bitcoin-cli.

To do this it shards the chain parameters into BaseParams, which
contains just the RPC port and data directory (as used by utils and
bitcoin-cli) and Params, with the rest.
2014-06-25 10:31:35 +02:00
Cory Fields
4791b99e2d crypto: create a separate lib for crypto functions
This lib has no dependencies on other bitcoin functionality. Attempting to
use bitcoin headers will result in a failure to compile.
2014-06-21 19:47:43 +02:00
Pieter Wuille
3820e01eb9 Extend and move all crypto tests to crypto_tests.cpp 2014-06-21 19:47:43 +02:00
Pieter Wuille
1cc344ce42 Add built-in SHA-1 implementation. 2014-06-21 19:47:39 +02:00
Pieter Wuille
977cdadea8 Add a built-in SHA256/SHA512 implementation.
This also moves the HMAC-SHA512 implementation to sha2.cpp.
2014-06-21 19:47:39 +02:00
Cory Fields
f4d81129f0 build: quit abusing AM_CPPFLAGS
Now that the build is non-recursive, adding to AM_CPPFLAGS means adding to
_all_ cppflags.

Logical groups of includes have been added instead, and are used individually
by various targets.
2014-06-05 16:05:57 -04:00
Cory Fields
56c157d5e0 build: avoid the use of top_ and abs_ dir paths
Using them has the side effect of confusing the dependency-tracking logic.
2014-06-05 16:05:57 -04:00
Cory Fields
6b9f0d5554 build: nuke Makefile.include from orbit
Rules and targets no longer need to be shared between subdirectories, so
this is no longer needed.
2014-06-05 16:05:57 -04:00
Cory Fields
65e8ba4dbe build: Switch to non-recursive make
Build logic moves from individual Makefile.am's to include files, which
the main src/Makefile.am includes. This avoids having to manage a gigantic
single Makefile.

TODO: Move the rules from the old Makefile.include to where they actually
belong and nuke the old file.
2014-06-05 16:05:17 -04:00