Commit graph

634 commits

Author SHA1 Message Date
Wladimir J. van der Laan dd4ffcec0e
Merge pull request #5859
9519a9a Add correct bool combiner for net signals (Pieter Wuille)
2015-03-12 11:14:03 +01:00
Wladimir J. van der Laan 92fd887fd4 tests: add a BasicTestingSetup and apply to all tests
Make sure that chainparams and logging is properly initialized. Doing
this for every test may be overkill, but this initialization is so
simple that that does not matter.

This should fix the travis issues.
2015-03-12 09:45:22 +01:00
Wladimir J. van der Laan 59bd89f116 test: Remove UNITTEST params
UNITTEST parameter are not used by any current tests, and the model
(modifyable parameters) is inconvenient when unit-testing. As
they are stored in a global structure eevery test
would have to (re)set up its own parameters.

For consistency it is also better to test with MAIN parameters.
2015-03-09 16:06:14 +01:00
Wladimir J. van der Laan 8cbe1f4f58
tests: change main and wallet tests to BOOST_FIXTURE_TEST_SUITE
Avoid this travis error:

    test_bitcoin: chainparams.cpp:330: const CChainParams& Params():
    Assertion `pCurrentParams' failed.
    unknown location(0): fatal error in "subsidy_limit_test": signal:
    SIGABRT (application abort requested)
    test/allocator_tests.cpp(116): last checkpoint
2015-03-09 15:04:59 +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
Wladimir J. van der Laan 62b30f09ac Add serialize float/double tests 2015-03-06 17:21:59 +01:00
Wladimir J. van der Laan 01f9c3449a src/serialize.h: base serialization level endianness neutrality
Serialization type-safety and endianness compatibility.
2015-03-06 17:21:58 +01:00
Pieter Wuille 9519a9a420 Add correct bool combiner for net signals 2015-03-06 03:45:26 -08: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
Suhas Daftuar 78c6bedb9c Add test for DER-encoding edge case
The fix to NegateSignatureS caused a test which had been failing
in IsValidSignatureEncoding to then fail in IsLowDERSignature.
Add new test so the original check remains exercised.
2015-02-10 13:25:41 -05:00
Suhas Daftuar 6f50dbd2fd Fix NegateSignatureS to not duplicate last byte of S
NegateSignatureS is called with a signature without a hashtype, so
do not save the last byte and append it after S negation.

Updates the two tests which were affected by this bug.
2015-02-10 13:23:57 -05:00
Cory Fields 7f991e364e c++11: These look like user-defined literals.
Add a space to keep the compiler happy
2015-02-03 23:31:00 -05:00
Wladimir J. van der Laan fcf646c9b0
Merge pull request #5286
44e9a6b Update the 'test_IsStandard' unit test (Flavien Charlon)
a930658 Change the default maximum OP_RETURN size to 80 bytes (Flavien Charlon)
2015-02-03 13:12:44 +01:00
Wladimir J. van der Laan 41e6e4caba
Merge pull request #5713
bf6cdeb Increase coverage of DERSIG edge cases (Pieter Wuille)
819bcf9 Add RPC test for DERSIG BIP switchover logic (Pieter Wuille)
5a47811 BIP66 changeover logic (Pieter Wuille)
092e9fe Example unit tests from BIP66 (Pieter Wuille)
80ad135 Change IsDERSignature to BIP66 implementation (Pieter Wuille)
2015-02-03 10:34:53 +01:00
Pieter Wuille 9fddceda44 Avoid storing a reference passed to SignatureChecker constructors 2015-02-02 20:19:46 -08:00
Pieter Wuille 858809a33e Use separate SignatureChecker for CMutableTransaction 2015-02-02 20:19:12 -08:00
Pieter Wuille bf6cdebdc5 Increase coverage of DERSIG edge cases 2015-02-01 17:51:25 -04:00
Pieter Wuille 092e9fe5fb Example unit tests from BIP66 2015-02-01 17:47:21 -04:00
Pavel Janík 5262fde0ec Remove whitespaces before double colon in errors and logs 2015-01-31 17:38:28 -05:00
Manuel Araoz d6bed1514c remove sig_canonical.json and sig_noncanonical.json 2015-01-31 17:36:44 -05:00
Wladimir J. van der Laan 6b5f5294bb
Merge pull request #5506
7873633 Squashed 'src/secp256k1/' changes from bccaf86..50cc6ab (Pieter Wuille)
1a9576d Use libsecp256k1's RFC6979 implementation (Pieter Wuille)
2015-01-26 13:04:29 +01:00
Wladimir J. van der Laan 8204e19abe
Merge pull request #4805
44bc988 [Wallet] Do not flush the wallet in AddToWalletIfInvolvingMe(..) (Cozz Lovan)
2015-01-26 12:19:12 +01:00
Peter Todd 2fa9a8ec86
Make empty byte arrays pass CheckSignatureEncoding()
Makes it possible to compactly provide a delibrately invalid signature
for use with CHECK(MULTI)SIG. For instance with BIP19 if m != n invalid
signatures need to be provided in the scriptSig; prior to this change
those invalid signatures would need to be large DER-encoded signatures.

Note that we may want to further expand on this change in the future by
saying that only OP_0 is a "valid" invalid signature; BIP19 even with
this change is inherently malleable as the invalid signatures can be any
validly encoded DER signature.
2015-01-09 06:03:22 -05:00
Wladimir J. van der Laan c6a5ad4819
Fix tests after #5413
Pull #5413 was not rebased after deterministic signing was merged
(#5227), so the testcases had to be regenerated using UPDATE_JSON_TESTS.
2015-01-08 12:53:05 +01:00
Wladimir J. van der Laan c5e0aef5c4
Merge pull request #5604
d58c5d6 tests: run sanity checks in tests too (Cory Fields)
2015-01-08 12:07:06 +01:00
Wladimir J. van der Laan 48e1765e27
Merge pull request #5143
da918ac Make SCRIPT_VERIFY_CLEANSTACK a standardness requirement (Pieter Wuille)
b6e03cc Add SCRIPT_VERIFY_CLEANSTACK (BIP62 rule 6) (Pieter Wuille)
ae4151b No semantic change: reuse stack variable in P2SH evaluation (Pieter Wuille)
2015-01-08 12:01:22 +01:00
Wladimir J. van der Laan 37b185c4af
Merge pull request #5611
f0b8afc tests: fix spurious windows test failures after 012598880c (Cory Fields)
2015-01-07 15:02:52 +01:00
Cory Fields f0b8afc88b tests: fix spurious windows test failures after 012598880c
on rare occasions, rand() was returning duped values, causing duplicate
transactions.

BuildMerkleTree happily used these, but CPartialMerkleTree caught them and
returned a null merkle root.

Rather than taking changes with rand(), use the loop counter to guarantee
unique values.

At sipa's request, also remove the remaining uses of rand().
2015-01-06 20:18:12 -05:00
Wladimir J. van der Laan 729ba31749
Merge pull request #5513
856e862 namespace: drop most boost namespaces and a few header cleanups (Cory Fields)
9b1ab86 namespace: drop boost::assign altogether here (Cory Fields)
a324199 namespace: remove boost namespace pollution (Cory Fields)
2015-01-06 20:32:45 +01:00
Wladimir J. van der Laan a89b8371d6
Merge pull request #5564
de236f5 clarify obscure uses of EvalScript() (Pavel Vasin)
2015-01-06 11:51:18 +01: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
Pieter Wuille 1a9576de9d Use libsecp256k1's RFC6979 implementation 2015-01-06 00:28:44 +01:00
Wladimir J. van der Laan 6bd0dc2a84 arith_uint256: remove initialization from byte vector
Remove initialization from vector (as this is only used in the tests).

Also implement SetHex and GetHex in terms of uint256, to avoid
duplicate code as well as avoid endianness issues (as they
work in term of bytes).
2015-01-05 15:45:36 +01:00
Wladimir J. van der Laan 30007fda76 Remove now-unused methods from arith_uint256 and base_uint
- Methods that access the guts of arith_uint256 are removed,
as these are incompatible between endians. Use uint256 instead

- Serialization is no longer needed as arith_uint256's are never
read or written

- GetHash is never used on arith_uint256
2015-01-05 15:45:36 +01:00
Wladimir J. van der Laan edc720479d Remove arith_uint160
We never do 160-bit arithmetic.
2015-01-05 15:45:36 +01: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
Wladimir J. van der Laan 734f85c4f0 Use arith_uint256 where necessary
Also add conversion from/to uint256 where needed.
2015-01-05 15:45:35 +01:00
Wladimir J. van der Laan 34cdc41128 String conversions uint256 -> uint256S
If uint256() constructor takes a string, uint256(0) will become
dangerous when uint256 does not take integers anymore (it will go
through std::string(const char*) making a NULL string, and the explicit
keyword is no help).
2015-01-05 15:45:35 +01:00
Wladimir J. van der Laan 2eae3157f6 Replace uint256(1) with static constant
SignatureHash and its test function SignatureHashOld
return uint256(1) as a special error signaling value.
Return a local static constant with the same value instead.
2015-01-05 15:45:34 +01:00
Wladimir J. van der Laan 4f1524966a Replace direct use of 0 with SetNull and IsNull
Replace x=0 with .SetNull(),
x==0 with IsNull(), x!=0 with !IsNull().
Replace uses of uint256(0) with uint256().
2015-01-05 15:45:34 +01:00
Cory Fields 856e862f4a namespace: drop most boost namespaces and a few header cleanups
A few boost::asio were left around because they're very wordy otherwise.
2015-01-02 15:12:03 -05:00
Cory Fields 9b1ab860ff namespace: drop boost::assign altogether here
Standard functions are even simpler
2015-01-02 15:12:03 -05:00
Wladimir J. van der Laan f55c5e9749
Merge pull request #5349
0125988 Implement test for merkle tree malleability in CPartialMerkleTree (Pieter Wuille)
2015-01-02 18:06:52 +01:00
Wladimir J. van der Laan e6df2bb48f Remove redundant copyright notices from README files
The normative place for these for the entire project is COPYING,
and the main README already has a MIT license section.
2015-01-02 10:46:23 +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
Pavel Vasin de236f57c6 clarify obscure uses of EvalScript()
The 3rd argument of EvalScript() is the unsigned int flags, not a bool.
2014-12-30 10:01:16 +03:00
Eric R. Schulz 2c14d1532f bitcoin-tx: Add test case for signing a tx 2014-12-24 01:56:28 +00:00
Everett Forth 7c5dd60306 Adding RPC tests for the following wallet related calls: getbalance,
listsinceblock, listtransactions, listlockunspent, listaccounts
listaddressgroupings
2014-12-23 02:27:17 -08:00
sandakersmann f914f1a746
Added "Core" to copyright headers
Github-Pull: #5494
Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-12-19 19:55:32 +01:00
Wladimir J. van der Laan 111a7d45f1
Merge pull request #5470
78253fc Remove references to X11 licence (Michael Ford)
2014-12-19 19:23:23 +01:00
Wladimir J. van der Laan 886eb57507
Merge pull request #5421
cac15be Test unexecuted OP_CODESEPARATOR (Peter Todd)
2014-12-19 17:54:21 +01:00
Philip Kaufmann 27df4123c4 make all catch() arguments const
- I saw this on http://en.cppreference.com/w/cpp/language/try_catch and
  thought it would be a good idea
- also unify used format to better be able to search for exception
  uses in our codebase
2014-12-17 09:39:24 +01:00
Michael Ford 78253fcbad Remove references to X11 licence 2014-12-16 15:56:50 +08:00
Manuel Araoz 87e8e1ca8b minor fix on script test data docs 2014-12-16 00:55:21 -03:00
Pieter Wuille 012598880c Implement test for merkle tree malleability in CPartialMerkleTree
This is a check that is mentioned in BIP 37, but never implemented in the
reference code. As Bitcoin Core so far never decodes partial merkle trees,
this is not a problem. But perhaps others use the code as a reference.
2014-12-11 17:22:15 +01:00
Wladimir J. van der Laan 4f85383cb3
Merge pull request #5409
65b0328 newlines in strings are invalid JSON (Ryan X. Charles)
2014-12-09 10:07:35 +01:00
Pavel Janík a26bf478ea Add a new test for FormatParagraph (string longer than the default width). 2014-12-06 22:49:07 +01:00
Matt Corallo afd4b94b6d Move CMerkleBlock and CPartialMerkleTree to their own file 2014-12-05 01:57:40 -08:00
Peter Todd cac15bedb1
Test unexecuted OP_CODESEPARATOR
OP_CODESEPARATOR is an actual executed instruction, not a declarative
thing, so if it's wrapped in an OP_IF it can be turned off.

Using this to implement Rivest's Paywords is left as an exercise for the
reader.
2014-12-04 00:53:16 -05:00
Luke Dashjr d227011184 MOVEONLY: core/ -> primitives/ 2014-12-03 10:52:58 +00:00
Ryan X. Charles 65b03282c9
newlines in strings are invalid JSON
Although script_valid.json and script_invalid.json are loaded correctly by the
JSON interpreter used by bitcoin core, these same files are often used by other
libraries and do not necessarily load correctly due to the fact that newlines
contained inside strings are not valid and must instead use the escape
character \n. The files tx_valid.json and tx_invalid.json handle this
correctly, so I've changed the formatting in script_valid.json and
script_invalid.json to mirror those files.
2014-12-02 10:02:44 -08:00
Pieter Wuille 362001c19f Move CHECKMULTISIG order tests out of automatically generated block 2014-12-01 21:37:20 +01:00
Pieter Wuille f67a9ce0dc Use deterministically generated script tests
Now that signing is deterministic, we can require exact correspondence between the
automatically generated tests and the ones read from JSON. Do this, and update
the tests to those deterministic versions. Note that some flag changes weren't
correctly applied before.
2014-12-01 21:29:02 +01:00
Wladimir J. van der Laan f0877f8b62
Merge pull request #5227
4cdaa95 Resize after succesful result (Pieter Wuille)
9d8604f Header define style cleanups (Pieter Wuille)
a53fd41 Deterministic signing (Pieter Wuille)
3060e36 Add the RFC6979 PRNG (Pieter Wuille)
a8f5087 Add HMAC-SHA256 (Pieter Wuille)
36fa4a7 Split up crypto/sha2 (Pieter Wuille)
2014-12-01 14:57:58 +01:00
Pieter Wuille b6e03cc592 Add SCRIPT_VERIFY_CLEANSTACK (BIP62 rule 6)
Based on an earlier patch by Peter Todd, though the rules here are different
(P2SH scripts should not have a CLEANSTACK check before the P2SH evaluation).
2014-11-25 12:38:01 +01:00
Wladimir J. van der Laan f24bcce2ac
Merge pull request #1816
b867e40 CreateNewBlock: Stick height in coinbase so we pass template sanity check (Luke Dashjr)
60755db submitblock: Check for duplicate submissions explicitly (Luke Dashjr)
bc6cb41 QA RPC tests: Add tests block block proposals (Luke Dashjr)
9765a50 Implement BIP 23 Block Proposal (Luke Dashjr)
3dcbb9b Abstract DecodeHexBlk and BIP22ValidationResult functions out of submitblock (Luke Dashjr)
132ea9b miner_tests: Disable checkpoints so they don't fail the subsidy-change test (Luke Dashjr)
df08a62 TestBlockValidity function for CBlock proposals (used by CreateNewBlock) (Luke Dashjr)
4ea1be7 CreateNewBlock and miner_tests: Also check generated template is valid by CheckBlockHeader, ContextualCheckBlockHeader, CheckBlock, and ContextualCheckBlock (Luke Dashjr)
a48f2d6 Abstract context-dependent block checking from acceptance (Luke Dashjr)
2014-11-24 14:43:10 +01:00
Pieter Wuille d0c41a7350 Add sanity check after key generation
Add a sanity check to prevent cosmic rays from flipping a bit in the
generated public key, or bugs in the elliptic curve code. This is
simply done by signing a (randomized) message, and verifying the
result.
2014-11-23 10:47:39 +01:00
Pieter Wuille a53fd41485 Deterministic signing 2014-11-20 17:22:06 +01:00
Pieter Wuille 3060e36098 Add the RFC6979 PRNG 2014-11-20 17:22:06 +01:00
Pieter Wuille a8f5087e53 Add HMAC-SHA256 2014-11-20 17:22:06 +01:00
Pieter Wuille 36fa4a78ac Split up crypto/sha2 2014-11-20 17:22:02 +01:00
Peter Todd ca8158719b Test the exact order of CHECKMULTISIG sig/pubkey evaluation
Possible with STRICTENC
2014-11-20 15:29:28 +01:00
Pieter Wuille 98b135f97f Make STRICTENC invalid pubkeys fail the script rather than the opcode.
This turns STRICTENC turn into a softforking-safe change (even though it
is not intended as a consensus rule), and as a result guarantee that using
it for mempool validation only results in consensus-valid transactions in
the mempool.
2014-11-20 15:29:26 +01:00
Pieter Wuille 3ba5ebc065
Merge pull request #5000
0391423 Discourage NOPs reserved for soft-fork upgrades (Peter Todd)
2014-11-20 15:27:39 +01:00
Cory Fields 269efa30ed build: add quick consensus lib tests
They should be hooked up in other places as well, but this is a start.
2014-11-19 22:31:10 -05:00
Luke Dashjr 132ea9b48f miner_tests: Disable checkpoints so they don't fail the subsidy-change test 2014-11-18 19:20:10 +00:00
Pieter Wuille 4c97c64bf6 Do not use EC code in global constructors 2014-11-18 18:06:46 +01:00
Peter Todd 03914234b3
Discourage NOPs reserved for soft-fork upgrades
NOP1 to NOP10 are reserved for future soft-fork upgrades. In the event
of an upgrade such NOPs have *VERIFY behavior, meaning that if their
arguments are not correct the script fails. Discouraging these NOPs by
rejecting transactions containing them from the mempool ensures that
we'll never accept transactions, nor mine blocks, with scripts that are
now invalid according to the majority of hashing power even if we're not
yet upgraded. Previously this wasn't an issue as the IsStandard() rules
didn't allow upgradable NOPs anyway, but 7f3b4e95 relaxed the
IsStandard() rules for P2SH redemptions allowing any redeemScript to be
spent.

We *do* allow upgradable NOPs in scripts so long as they are not
executed. This is harmless as there is no opportunity for the script to
be invalid post-upgrade.
2014-11-17 22:22:33 -05:00
Flavien Charlon 44e9a6b22e Update the 'test_IsStandard' unit test
The maximum length for the payload of an OP_RETURN output is now
80 bytes, and unit tests must be modified to account for the change.
2014-11-16 15:43:12 +00:00
Cory Fields 219a1470c4 script: check ScriptError values in script tests 2014-11-14 16:25:53 -05:00
Pieter Wuille f4e0aefadc Do signature-s negation inside the tests
To avoid the need for libsecp256k1 to expose such functionality.
2014-11-10 05:03:24 -08:00
Wladimir J. van der Laan df504e924a
Merge pull request #5196
8473862 Fix all header defines (Pavel Janík)
2014-11-04 09:33:22 +01:00
Wladimir J. van der Laan 73b82a3089
Merge pull request #5162
d2e74c5 boost: moveonly: split CPubKey and friends to new files (Cory Fields)
78c228c boost: moveonly: move BIP32Hash to hash.h (Cory Fields)
900078a boost: moveonly: create eccryptoverify.h|cpp and move helper functions there (Cory Fields)
2014-11-04 09:26:45 +01:00
Pavel Janík 84738627ce Fix all header defines 2014-11-03 16:16:40 +01:00
Wladimir J. van der Laan 84d26d3a36
Merge pull request #5106
1bea2bb Rename ProcessBlock to ProcessNewBlock to indicate change of behaviour, and document it (Luke Dashjr)
d29a291 Rename RPC_TRANSACTION_* errors to RPC_VERIFY_* and use RPC_VERIFY_ERROR for submitblock (Luke Dashjr)
f877aaa Bugfix: submitblock: Use a temporary CValidationState to determine accurately the outcome of ProcessBlock, now that it no longer does the full block validity check (Luke Dashjr)
24e8896 Add CValidationInterface::BlockChecked notification (Luke Dashjr)
2014-11-03 12:22:45 +01:00
Cory Fields d2e74c55bd boost: moveonly: split CPubKey and friends to new files 2014-10-31 01:19:37 -04:00
Cory Fields f635269cd1 tests: enable alertnotify test for Windows
The semantics of "echo" are different there and they change the resulting text,
but they're still correct and predictable.
2014-10-31 00:04:14 -04:00
Cory Fields 71697f97d3 Separate protocol versioning from clientversion 2014-10-29 00:24:40 -04:00
Pieter Wuille 723c752636
Merge pull request #5100
99f41b9 MOVEONLY: core.o -> core/block.o (jtimon)
561e9e9 MOVEONLY: Move script/compressor out of script and put CTxOutCompressor (from core) with it (jtimon)
999a2ab MOVEONLY: separate CTxUndo out of core (jtimon)
4a3587d MOVEONLY: Separate CTransaction and dependencies from core (jtimon)
eda3733 MOVEONLY: Move CFeeRate and Amount constants to amount.o (jtimon)
2014-10-28 05:27:41 -07:00
Wladimir J. van der Laan cd9114e513
Merge pull request #5065
16d78bd Add valid invert of invalid every numeric opcode tests (Peter Todd)
2b62e17 Clearly separate PUSHDATA and numeric argument MINIMALDATA tests (Peter Todd)
dfeec18 Test every numeric-accepting opcode for correct handling of the numeric minimal encoding rule (Peter Todd)
554147a Ensure MINIMALDATA invalid tests can only fail one way (Peter Todd)
6004e77 Improve CScriptNum() comment (Peter Todd)
698c6ab Add SCRIPT_VERIFY_MINIMALDATA (BIP62 rules 3 and 4) (Pieter Wuille)
d752ba8 Add SCRIPT_VERIFY_SIGPUSHONLY (BIP62 rule 2) (Pieter Wuille)
2014-10-28 13:19:38 +01:00
Luke Dashjr 1bea2bbddc Rename ProcessBlock to ProcessNewBlock to indicate change of behaviour, and document it 2014-10-28 08:15:14 +00:00
jtimon 561e9e9de9 MOVEONLY: Move script/compressor out of script and put CTxOutCompressor (from
core) with it
2014-10-27 13:54:37 +01:00
jtimon 4a3587d8db MOVEONLY: Separate CTransaction and dependencies from core 2014-10-27 13:54:37 +01:00
Peter Todd 16d78bd68e Add valid invert of invalid every numeric opcode tests 2014-10-25 03:13:15 -07:00
Peter Todd 2b62e1796b Clearly separate PUSHDATA and numeric argument MINIMALDATA tests 2014-10-25 03:12:39 -07:00
Peter Todd dfeec18b85 Test every numeric-accepting opcode for correct handling of the numeric minimal encoding rule 2014-10-25 03:12:06 -07:00
Peter Todd 554147ad9e Ensure MINIMALDATA invalid tests can only fail one way
Removes the need for the 'negated' versions of the tests, and ensures
other failures don't mask what we're trying to test.
2014-10-25 03:11:38 -07:00
Pieter Wuille 698c6abb25 Add SCRIPT_VERIFY_MINIMALDATA (BIP62 rules 3 and 4)
Also use the new flag as a standard rule, and replace the IsCanonicalPush
standardness check with it (as it is more complete).
2014-10-25 03:03:20 -07:00
Pieter Wuille d752ba86c1 Add SCRIPT_VERIFY_SIGPUSHONLY (BIP62 rule 2) 2014-10-25 03:03:16 -07:00
Cory Fields fa7361907a boost: split stream classes out of serialize.h
serialization now has no dependencies.
2014-10-22 15:21:06 -04:00
Wladimir J. van der Laan 25cc1cf8dc
Merge pull request #4981
85c579e script: add a slew of includes all around and drop includes from script.h (Cory Fields)
db8eb54 script: move ToString and ValueString out of the header (Cory Fields)
e9ca428 script: add ToByteVector() for converting anything with begin/end (Cory Fields)
066e2a1 script: move CScriptID to standard.h and add a ctor for creating them from CScripts (Cory Fields)
2014-10-22 12:16:50 +02:00
Wladimir J. van der Laan f984c7d7ad
Merge pull request #5108
a873823 CAutoFile: Explicit Get() and remove unused methods (Wladimir J. van der Laan)
fef24ca Add IsNull() to class CAutoFile and remove operator ! (Ruben Dario Ponticeli)
2014-10-22 10:47:14 +02:00
Wladimir J. van der Laan 7305620599
Merge pull request #5110
a3c26c2 Fixes for missing boost tuple.hpp header include. (randy-waterhouse)
2014-10-22 10:37:52 +02:00
Wladimir J. van der Laan a873823864
CAutoFile: Explicit Get() and remove unused methods
Also add documentation to some methods.
2014-10-22 10:18:19 +02:00
randy-waterhouse a3c26c2e85 Fixes for missing boost tuple.hpp header include. 2014-10-21 17:33:06 +13:00
Pieter Wuille a96d113962 Rename CWalletInterface to CValidationInterface
It's useful for much more than wallets.
2014-10-20 10:59:12 -07:00
Cory Fields 85c579e3a6 script: add a slew of includes all around and drop includes from script.h
Lots of files ended up with indirect includes from script.h.
2014-10-17 13:44:57 -04:00
Cory Fields e9ca4280f3 script: add ToByteVector() for converting anything with begin/end
This should move to a util header once their dependencies are cleaned up.
2014-10-17 13:44:14 -04:00
Cory Fields 066e2a1403 script: move CScriptID to standard.h and add a ctor for creating them from CScripts
This allows for a reversal of the current behavior.

This:
CScript foo;
CScriptID bar(foo.GetID());

Becomes:
CScript foo;
CScriptID bar(foo);

This way, CScript is no longer dependent on CScriptID or Hash();
2014-10-17 13:44:14 -04:00
Wladimir J. van der Laan 84d13eef88
Merge pull request #4468
e11b2ce Fix large reorgs (Pieter Wuille)
afc32c5 Fix rebuild-chainstate feature and improve its performance (Pieter Wuille)
16d5194 Skip reindexed blocks individually (Pieter Wuille)
ad96e7c Make -reindex cope with out-of-order blocks (Wladimir J. van der Laan)
e17bd58 Rename setBlockIndexValid to setBlockIndexCandidates (Pieter Wuille)
1af838b Add height to "Requesting block" debug (R E Broadley)
1bcee67 Better logging of stalling (R E Broadley)
4c93322 Improve getheaders (sending) logging (R E Broadley)
f244c99 Remove CheckMinWork, as we always know all parent headers (Pieter Wuille)
ad6e601 RPC additions after headers-first (Pieter Wuille)
341735e Headers-first synchronization (Pieter Wuille)
2014-10-17 12:30:54 +02:00
Cory Fields 5f4bcf6b14 boost: drop boost dependency in version.cpp.
Also add a test to verify.
2014-10-15 15:13:20 -04:00
Pieter Wuille f244c99c96 Remove CheckMinWork, as we always know all parent headers 2014-10-14 15:42:01 -07:00
Luke e21b2e0d5f Typo in test 2014-10-13 16:57:09 +01: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 d4a42334d4
Merge pull request #4834
7c70438 Get rid of the dummy CCoinsViewCache constructor arg (Pieter Wuille)
ed27e53 Add coins_tests with a large randomized CCoinViewCache test. (Pieter Wuille)
058b08c Do not keep fully spent but unwritten CCoins entries cached. (Pieter Wuille)
c9d1a81 Get rid of CCoinsView's SetCoins and SetBestBlock. (Pieter Wuille)
f28aec0 Use ModifyCoins instead of mutable GetCoins. (Pieter Wuille)
2014-10-08 14:58:16 -07:00
Pieter Wuille 2c930d932b Prettify JSON tests and minimize diffs 2014-10-07 09:41:33 +02:00
Wladimir J. van der Laan 5f1aee066a
Merge pull request #4890
e790c37 Replace SCRIPT_VERIFY_NOCACHE by flag directly to checker (Pieter Wuille)
5c1e798 Make signature cache optional (Pieter Wuille)
c7829ea Abstract out SignatureChecker (Pieter Wuille)
2014-10-06 04:39:17 +02:00
Cozz Lovan 44bc988e7b [Wallet] Do not flush the wallet in AddToWalletIfInvolvingMe(..) 2014-10-03 05:11:27 +02:00
jtimon 54510f2672 DRY: Avoid repetitions in script_test 2014-10-02 21:48:29 +02:00
Pieter Wuille e790c370b5 Replace SCRIPT_VERIFY_NOCACHE by flag directly to checker 2014-10-02 20:26:58 +02:00
Pieter Wuille c7829ea797 Abstract out SignatureChecker 2014-10-02 20:26:16 +02:00
Wladimir J. van der Laan 20a4b69360
Merge pull request #4985
bc470c4 Changed mixed indentation to four spaces (Eric Shaw)
31d6390 Fixed setaccount accepting foreign address (Eric Shaw)
2014-10-02 19:31:50 +02:00
Eric Shaw bc470c43ee Changed mixed indentation to four spaces
Put `test/rpc_wallet_tests.cpp` through clang-format.
2014-10-02 19:23:30 +02:00
Eric Shaw 31d6390fd1 Fixed setaccount accepting foreign address
Fixed issue #4209 where using setaccount with a foreign
address causes the address to be added to your receiving addresses.
2014-10-02 19:21:46 +02:00
SergioDemianLerner f0fd00cb77 Switch testing framework from MAIN to new UNITTEST network
UNITTEST inherites from MAIN but allows synamically changing its parameters using the ModifiableParams() interface
2014-10-02 13:51:39 +02:00
Wladimir J. van der Laan 8d132431b4
Revert merge of pull #4845
It breaks the new mingw tests!

See

- https://travis-ci.org/bitcoin/bitcoin/jobs/36845581
- https://travis-ci.org/bitcoin/bitcoin/jobs/36845582

This reverts commit 4705902777, 5e2e7fcb99, a25fd6be13.
2014-10-02 10:39:55 +02:00
Wladimir J. van der Laan ad51e14583
Merge pull request #4845
4705902 Avoid introducing a virtual into CChainParams (Wladimir J. van der Laan)
5e2e7fc Suggested corrections on comments, variable names. Also new test case testing the PoW skip in UNITTEST. (SergioDemianLerner)
a25fd6b Switch testing framework from MAIN to new UNITTEST network (SergioDemianLerner)
2014-10-02 09:47:54 +02:00
Wladimir J. van der Laan 3fd192f8b4
Merge pull request #4234
c122f55 qt: Register CAmount metatype (Wladimir J. van der Laan)
a372168 Use a typedef for monetary values (Mark Friedenbach)
2014-10-01 11:28:55 +02:00
Wladimir J. van der Laan a6f3e9d843
Merge pull request #5014
41d67c7 tests: fix python test-runner for windows (Cory Fields)
2014-10-01 08:55:34 +02:00
Gavin Andresen e5836eb692 Merge pull request #5015 from theuni/win64test
tests: fix false-positive under win64
2014-09-30 19:54:08 -04:00
Cory Fields 63c17613ab tests: fix false-positive under win64
BN_ULONG isn't necessarily an unsigned long, as is the case on win64.
2014-09-30 18:16:14 -04:00
Cory Fields 41d67c78bf tests: fix python test-runner for windows
Windows needed a few fixups to get the tests running:
1. bitcoin-tx needs a file extension in Windows. Take this opportunity to
   add an env file, which pulls variables out of our build config. This can
   be extended as needed, for now it's very simple.
2. After #1, split the args out of the exec key in the test data.
3. Correct the line-endings from windows stdout
2014-09-30 16:26:22 -04:00
Pieter Wuille 68af7d02cf Fix vector out of bounds in script tests 2014-09-29 19:26:23 +02:00
Pieter Wuille 2884b9a4ae
Merge pull request #4960
8138cbe Add automatic script test generation, and actual checksig tests (Pieter Wuille)
2014-09-29 18:36:04 +02:00
SergioDemianLerner 5e2e7fcb99 Suggested corrections on comments, variable names.
Also new test case testing the PoW skip in UNITTEST.
2014-09-29 13:03:23 +02:00
SergioDemianLerner a25fd6be13 Switch testing framework from MAIN to new UNITTEST network
UNITTEST inherites from MAIN but allows synamically changing its parameters using the ModifiableParams() interface
2014-09-29 13:03:22 +02:00
Wladimir J. van der Laan 41150d601d
Merge pull request #4970
93e24dd travis: use debug for one build (Cory Fields)
be6d87a script: don't read past the end (Cory Fields)
a94496f tests: don't split an empty string (Cory Fields)
00522cd depends: disable reduced exports for debug builds (Cory Fields)
1f7fff2 depends: add docs for debug (Cory Fields)
dc66ff5 depends: make LDFLAGS act like the other flags (Cory Fields)
b1efba8 depends: give miniupnpc cppflags (Cory Fields)
1d154db depends: teach qt to honor debug/release (Cory Fields)
3b63df5 depends: boost: build for debug or release as requested (Cory Fields)
7e99df7 depends: make sure openssl sees cppflags (Cory Fields)
f397304 depends: add debug/release flags for linux/osx/win (Cory Fields)
2027ad3 depends: add the debug/release concept to depends (Cory Fields)
2014-09-29 09:36:54 +02:00
Mark Friedenbach a372168e77 Use a typedef for monetary values 2014-09-26 15:42:04 -07:00
Pieter Wuille 8138cbea3c Add automatic script test generation, and actual checksig tests 2014-09-26 21:58:48 +02:00
Cory Fields eee030f6bc autofile: don't copy CAutoFile by value 2014-09-25 19:25:19 -04:00
Cory Fields a94496fbb6 tests: don't split an empty string 2014-09-25 14:56:26 -04:00
Wladimir J. van der Laan b50e5fe099
Merge pull request #4968
219372f script: Fix reference into empty vector run time exception (ENikS)
2014-09-25 11:48:33 +02:00
ENikS 219372f1dd
script: Fix reference into empty vector run time exception
Edit by laanwj: `begin_ptr(sourcedata) + sourcedata.size()` -> `end_ptr(sourcedata)`
2014-09-25 11:46:52 +02:00
Pieter Wuille 7c70438dc6 Get rid of the dummy CCoinsViewCache constructor arg 2014-09-24 03:19:04 +02:00
Pieter Wuille ed27e53c9b Add coins_tests with a large randomized CCoinViewCache test. 2014-09-23 22:29:45 +02:00
Pieter Wuille c9d1a81ce7 Get rid of CCoinsView's SetCoins and SetBestBlock.
All direct modifications are now done through ModifyCoins, and BatchWrite is
used for pushing batches of queued modifications up, so we don't need the
low-level SetCoins and SetBestBlock anymore in the top-level CCoinsView class.
2014-09-23 22:29:21 +02:00
ENikS c8063b5712 Fixing out of bounds asses error 2014-09-23 11:17:43 -04:00
Pieter Wuille c8589bf99e Add actual signature tests 2014-09-22 19:26:17 +02:00