Commit graph

887 commits

Author SHA1 Message Date
Suhas Daftuar
5de2baa138 Rename CTxMemPool::remove -> removeRecursive
remove is no longer called non-recursively, so simplify the logic
and eliminate an unnecessary parameter
2016-03-14 12:11:09 -04:00
MarcoFalke
fa3a81af18 [tests] Extend util_ParseMoney test case 2016-03-14 15:49:33 +01:00
Wladimir J. van der Laan
f1ca8915bb
Merge #7517: test: script_error checking in script_invalid tests
0ecb340 test: Script_error checking in script_invalid tests (Wladimir J. van der Laan)
2317ad7 test: Re-introduce JSON pretty printing in test builder (Wladimir J. van der Laan)
b0ff857 test: Move non-generated script_invalid test to the correct place (Wladimir J. van der Laan)
2016-03-14 11:30:06 +01:00
Mustafa
2fdaa25529 Move GetTempPath() to testutil. 2016-03-11 15:04:05 +00:00
Mustafa
393b22eacb Add a source file for unit test utils. 2016-03-11 12:03:45 +00:00
Suhas Daftuar
086da92ea7 Add tags to mempool's mapTx indices 2016-02-16 12:35:16 -05:00
Wladimir J. van der Laan
93c85d458a
Merge #7524: BIP-112: Mempool-only CHECKSEQUENCEVERIFY
a381076 Code style fix. (BtcDrak)
c3c3752 Separate CheckLockTime() and CheckSequence() logic (BtcDrak)
53e53a3 BIP112: Implement CHECKSEQUENCEVERIFY (Mark Friedenbach)
2016-02-16 10:46:34 +01:00
Wladimir J. van der Laan
f31b6b8995 test: test leading space for ParseHex
BerkeleyDB dump files have key and value lines indented.
The salvage code passes these to ParseHex as-is.
Check this in the tests (should just pass with current code).
2016-02-15 17:14:30 +01:00
Mark Friedenbach
53e53a33c9 BIP112: Implement CHECKSEQUENCEVERIFY
- Replace NOP3 with CHECKSEQUENCEVERIFY (BIP112)
  <nSequence> CHECKSEQUENCEVERIFY -> <nSequence>
- Fails if txin.nSequence < nSequence, allowing funds of a txout to be locked for a number of blocks or a duration of time after its inclusion in a block.
- Pull most of CheckLockTime() out into VerifyLockTime(), a local function that will be reused for CheckSequence()
- Add bitwise AND operator to CScriptNum
- Enable CHECKSEQUENCEVERIFY as a standard script verify flag
- Transactions that fail CSV verification will be rejected from the mempool, making it easy to test the feature. However blocks containing "invalid" CSV-using transactions will still be accepted; this is *not* the soft-fork required to actually enable CSV for production use.
2016-02-14 11:29:38 +00:00
Wladimir J. van der Laan
80d1f2e483
Merge #7184: Implement SequenceLocks functions for BIP 68
b043c4b fix sdaftuar's nits again (Alex Morcos)
a51c79b Bug fix to RPC test (Alex Morcos)
da6ad5f Add RPC test exercising BIP68 (mempool only) (Suhas Daftuar)
c6c2f0f Implement SequenceLocks functions (Alex Morcos)
2016-02-12 17:03:46 +01:00
Wladimir J. van der Laan
0ecb3401fe test: Script_error checking in script_invalid tests
Check the returned script_error. Add expected script_error
for generated as well as custom tests.

The specific error is not part of consensus, however
it could avoid unclear reporting issues such as #6862 in the future.

Fixes #7513.
2016-02-11 17:33:28 +01:00
Wladimir J. van der Laan
2317ad7c56 test: Re-introduce JSON pretty printing in test builder 2016-02-11 17:33:28 +01:00
Wladimir J. van der Laan
b0ff8572ae test: Move non-generated script_invalid test to the correct place
This test was introduced in 9fadf1c874,
but accidentally added in the autogenerated area.
2016-02-11 16:16:40 +01:00
Alex Morcos
c6c2f0fd78 Implement SequenceLocks functions
SequenceLocks functions are used to evaluate sequence lock times or heights per BIP 68.

The majority of this code is copied from maaku in #6312
Further credit: btcdrak, sipa, NicolasDorier
2016-02-10 15:35:33 -05:00
Wladimir J. van der Laan
acf5983502 tests: Remove May15 test
This test is no longer relevant.

It was introduced in 8c222dca4f to check
the switch to 1MB blocks after the BDB too-many-locks issue back in
2013. The switching code has been long since removed.

It also needs a specific data file that is hard to find. I've verified
in #6320 that it still passes, however I think there is zero reason to
keep it.

Closes #6320.
2016-02-09 16:23:52 +01:00
Wladimir J. van der Laan
4f4dc5ef72
Merge #7070: Move maxTxFee out of mempool
fad6244 ATMP: make nAbsurdFee const (MarcoFalke)
fa762d0 [wallet.h] Remove main.h include (MarcoFalke)
fa79db2 Move maxTxFee out of mempool (MarcoFalke)
2016-02-04 14:54:23 +01:00
Luke Dashjr
a68bb9f5e7 Merge branch 'master' into single_prodname 2016-02-03 05:41:13 +00:00
Luke Dashjr
cc2095ecae Rewrite FormatParagraph to handle newlines within input strings correctly 2016-02-03 05:38:43 +00:00
MarcoFalke
fa79db2641 Move maxTxFee out of mempool
Also, remove default values in CMerkleTx::AcceptToMemoryPool()
2016-02-02 20:08:51 +01:00
Pieter Wuille
5d743099b5 Get rid of inaccurate ScriptSigArgsExpected
(cherry picked from commit 52b29dca76)
2016-02-01 15:28:25 +01:00
Wladimir J. van der Laan
326ffed09b
Merge #7212: Adds unittests for CAddrMan and CAddrinfo, removes source of non-determinism.
40c87b6 Increase test coverage for addrman and addrinfo (Ethan Heilman)
2016-01-28 13:14:07 +01:00
Wladimir J. van der Laan
62f2d769e4
Merge #7348: MOVE ONLY: move rpc* to rpc/
d13f65e rpc: update inline comments to refer to new file paths (Daniel Cousens)
a0eaff8 move rpc* to rpc/ (Daniel Cousens)
2016-01-28 11:28:24 +01:00
Ethan Heilman
40c87b6e69 Increase test coverage for addrman and addrinfo
Adds several unittests for CAddrMan and CAddrInfo.
Increases the accuracy of addrman tests.
Removes non-determinism in tests by overriding the random number generator.
Extracts testing code from addrman class to test class.
2016-01-27 10:50:58 -05:00
Wladimir J. van der Laan
9189e30b12
Merge #7300: [trivial] Add missing copyright headers
fabcee1 Remove copyright header from autogenerated chainparamsseeds.h (MarcoFalke)
fa60d05 Add missing copyright headers (MarcoFalke)
fa7e4c0 Bump copyright headers to 2014 (MarcoFalke)
2016-01-27 12:06:31 +01:00
Daniel Cousens
a0eaff8a1d move rpc* to rpc/ 2016-01-21 08:36:55 +11:00
Wladimir J. van der Laan
9982710e88
Merge #7307: [RPC, Wallet] Move RPC dispatch table registration to wallet/ code
dd2dc40 [RPC, Wallet] Move RPC dispatch table registration to wallet/ code (Jonas Schnelli)
2016-01-20 15:15:51 +01:00
Jonas Schnelli
dd2dc400ee
[RPC, Wallet] Move RPC dispatch table registration to wallet/ code
Allow extending the rpc dispatch table by appending commands when server is not running.
2016-01-20 15:03:25 +01:00
Chris Wheeler
9d263bd17c Typo fixes in comments 2016-01-17 11:03:56 +00:00
Cory Fields
89f71c68c0 c++11: don't throw from the reverselock destructor
noexcept is default for destructors as of c++11. By throwing in reverselock's
destructor if it's lock has been tampered with, the likely result is
std::terminate being called. Indeed that happened before this change.

Once reverselock has taken another lock (its ctor didn't throw), it makes no
sense to try to grab or lock the parent lock. That is be broken/undefined
behavior depending on the parent lock's implementation, but it shouldn't cause
the reverselock to fail to re-lock when destroyed.

To avoid those problems, simply swap the parent lock's contents with a dummy
for the duration of the lock. That will ensure that any undefined behavior is
caught at the call-site rather than the reverse lock's destruction.

Barring a failed mutex unlock which would be indicative of a larger problem,
the destructor should now never throw.
2016-01-05 17:17:29 -05:00
MarcoFalke
fa60d05a4e Add missing copyright headers 2016-01-05 21:34:15 +01:00
MarcoFalke
fa7e4c0919 Bump copyright headers to 2014 2016-01-05 21:01:39 +01:00
Wladimir J. van der Laan
605c17844e
Merge pull request #7205
fa71669 [devtools] Use git pretty-format for year parsing (MarcoFalke)
fa24439 Bump copyright headers to 2015 (MarcoFalke)
fa6ad85 [devtools] Rewrite fix-copyright-headers.py (MarcoFalke)
2016-01-05 14:11:40 +01:00
21E14
a5a0831458 Double semicolon cleanup. 2015-12-30 12:23:07 -05:00
mb300sd
37d271d7cc Rename OP_NOP2 to OP_CHECKLOCKTIMEVERIFY. 2015-12-15 02:01:45 -05:00
MarcoFalke
fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01:00
Pieter Wuille
5400ef6bcb Replace trickle nodes with per-node/message Poisson delays
We used to have a trickle node, a node which was chosen in each iteration of
the send loop that was privileged and allowed to send out queued up non-time
critical messages. Since the removal of the fixed sleeps in the network code,
this resulted in fast and attackable treatment of such broadcasts.

This pull request changes the 3 remaining trickle use cases by random delays:
* Local address broadcast (while also removing the the wiping of the seen filter)
* Address relay
* Inv relay (for transactions; blocks are always relayed immediately)

The code is based on older commits by Patrick Strateman.
2015-12-11 22:20:38 +01:00
Wladimir J. van der Laan
8843676621
Merge pull request #7133
aa4b0c2 When not filtering blocks, getdata sends more in one test (Pieter Wuille)
d41e44c Actually only use filterInventoryKnown with MSG_TX inventory messages. (Gregory Maxwell)
b6a0da4 Only use filterInventoryKnown with MSG_TX inventory messages. (Patick Strateman)
6b84935 Rename setInventoryKnown filterInventoryKnown (Patick Strateman)
e206724 Remove mruset as it is no longer used. (Gregory Maxwell)
ec73ef3 Replace setInventoryKnown with a rolling bloom filter. (Gregory Maxwell)
2015-12-03 13:16:46 +01:00
Wladimir J. van der Laan
1b0241fcec
Merge pull request #7144
8f0d79e test: Disable scheduler test manythreads (Wladimir J. van der Laan)
2015-12-02 10:18:20 +01:00
Alex Morcos
553cad94e2 Rewrite CreateNewBlock
Use the score index on the mempool to only add sorted txs in order.  Remove much of the validation while building the block, relying on mempool to be consistent and only contain txs that can be mined.
The mempool is assumed to be consistent as far as not containing txs which spend non-existent outputs or double spends, and scripts are valid.  Finality of txs is still checked (except not coinbase maturity, assumed in mempool).
Still TestBlockValidity in case mempool consistency breaks and return error state if an invalid block was created.
Unit tests are modified to realize that invalid blocks can now be constructed if the mempool breaks its consistency assumptions and also updated to have the right fees, since the cached value is now used for block construction.

Conflicts:
	src/miner.cpp
2015-12-01 12:09:37 -05:00
Alex Morcos
f3fe83673e Add a score index to the mempool.
The score index is meant to represent the order of priority for being included in a block for miners.  Initially this is set to the transactions modified (by any feeDelta) fee rate.  Index improvements and unit tests by sdaftuar.
2015-12-01 10:10:25 -05:00
Alex Morcos
c49d5bc9e6 Store the total sig op count of a tx.
Store sum of legacy and P2SH sig op counts.  This is calculated in AcceptToMemory pool and storing it saves redoing the expensive calculation in block template creation.
2015-12-01 10:10:25 -05:00
Wladimir J. van der Laan
8f0d79e3c8 test: Disable scheduler test manythreads
It causes occasional deadlocks, resulting in false negatives in Travis.

Disable the test for now.
Works around #6540.
2015-12-01 14:43:38 +01:00
Wladimir J. van der Laan
2ef5ffa59a
Merge pull request #6915
2d8860e Fix removeForReorg to use MedianTimePast (Suhas Daftuar)
b7fa4aa Don't call removeForReorg if DisconnectTip fails (Suhas Daftuar)
7e49f5f Track coinbase spends in CTxMemPoolEntry (Suhas Daftuar)
bb8ea1f removeForReorg calls once-per-disconnect-> once-per-reorg (Matt Corallo)
474b84a Make indentation in ActivateBestChainStep readable (Matt Corallo)
b0a064c Fix comment in removeForReorg (Matt Corallo)
9b060e5 Fix removal of time-locked transactions during reorg (Matt Corallo)
0c9959a Add failing test checking timelocked-txn removal during reorg (Matt Corallo)
2015-12-01 13:17:34 +01:00
Wladimir J. van der Laan
327291af02
Merge pull request #6914
114b581 Prevector type (Pieter Wuille)
2015-12-01 10:22:14 +01:00
Gregory Maxwell
c143c499c8
Merge pull request #7072
996d311 [RPC] Add transaction size to JSON output (Nick)
2015-11-30 22:58:43 -08:00
Suhas Daftuar
7e49f5f8b4 Track coinbase spends in CTxMemPoolEntry
This allows us to optimize CTxMemPool::removeForReorg.
2015-11-30 13:12:53 -05:00
Gregory Maxwell
e20672479e Remove mruset as it is no longer used. 2015-11-30 12:53:48 +01:00
Nick
996d3117c7 [RPC] Add transaction size to JSON output
This may be useful for blockchain explorers.
2015-11-28 17:06:56 +03:00
Pieter Wuille
eece63fa72 Switch blocks to a constant-space Merkle root/branch algorithm.
This switches the Merkle tree logic for blocks to one that runs in constant (small) space.
The old code is moved to tests, and a new test is added that for various combinations of
block sizes, transaction positions to compute a branch for, and mutations:
 * Verifies that the old code and new code agree for the Merkle root.
 * Verifies that the old code and new code agree for the Merkle branch.
 * Verifies that the computed Merkle branch is valid.
 * Verifies that mutations don't change the Merkle root.
 * Verifies that mutations are correctly detected.
2015-11-27 15:36:52 +01:00
Wladimir J. van der Laan
d8368a07ba
Merge pull request #7095
4ec3561 Replace scriptnum_test's normative ScriptNum implementation (Wladimir J. van der Laan)
2015-11-27 14:16:55 +01:00
Wladimir J. van der Laan
5ca149a3db
Merge pull request #7053
2e29e7e Globals: Remove a bunch of Params() calls from main.cpp: (Jorge Timón)
2015-11-27 13:29:54 +01:00
Wladimir J. van der Laan
e92377fa7f
Merge pull request #6134
e304432 Pass reference to estimateSmartFee and cleanup whitespace (Suhas Daftuar)
56106a3 Expose RPC calls for estimatesmart functions (Alex Morcos)
e93a236 add estimateSmartFee to the unit test (Alex Morcos)
6303051 EstimateSmart functions consider mempool min fee (Alex Morcos)
f22ac4a Increase success threshold for fee estimation to 95% (Alex Morcos)
4fe2823 Change wallet and GUI code to use new smart fee estimation calls. (Alex Morcos)
22eca7d Add smart fee estimation functions (Alex Morcos)
2015-11-27 12:59:37 +01:00
Wladimir J. van der Laan
05d591839f
Merge pull request #5967
072e2f8 Alter assumptions in CCoinsViewCache::BatchWrite (Alex Morcos)
2015-11-27 12:44:00 +01:00
Wladimir J. van der Laan
4ec3561eb3 Replace scriptnum_test's normative ScriptNum implementation
Compare against the scriptnum from Bitcoin Core 0.10 instead of OpenSSL.
Closes #7086.
2015-11-25 13:59:49 +01:00
Jorge Timón
2e29e7e247 Globals: Remove a bunch of Params() calls from main.cpp:
1) Chainparams: Explicit CChainParams arg for main:

-AcceptBlock
-AcceptBlockHeader
-ActivateBestChain
-ConnectTip
-InitBlockIndex
-LoadExternalBlockFile
-VerifyDB parametric constructor

2) Also pickup more Params()\. in main.cpp

3) Pass nPruneAfterHeight explicitly to new FindFilesToPrune() in main.cpp
2015-11-23 12:14:40 +01:00
Gregory Maxwell
616d61b20d
Merge pull request #6851
3e7c891 Optimisation: Store transaction list order in memory rather than compute it every need (Luke Dashjr)
2015-11-20 18:52:44 -08:00
Luke Dashjr
3e7c89196c Optimisation: Store transaction list order in memory rather than compute it every need
Huge performance improvement (450%) for zapwallettxes
2015-11-21 01:48:25 +00:00
Alex Morcos
c0353064dd Change GetPriority calculation.
Compute the value of inputs that already are in the chain at time of mempool entry and only increase priority due to aging for those inputs.  This effectively changes the CTxMemPoolEntry's GetPriority calculation from an upper bound to a lower bound.
2015-11-19 21:44:35 -05:00
Alex Morcos
072e2f8644 Alter assumptions in CCoinsViewCache::BatchWrite
Previously it would break if you flushed a parent cache while there was a child cache referring to it.  This change will allow the flushing of parent caches.
2015-11-18 12:03:50 -05:00
Wladimir J. van der Laan
73fa5e6043
Merge pull request #6932
1cf3dd8 Add unit test for UpdateCoins (Alex Morcos)
03c8282 Make CCoinsViewTest behave like CCoinsViewDB (Alex Morcos)
14470f9 ModifyNewCoins saves database lookups (Alex Morcos)
2015-11-18 17:37:58 +01:00
Alex Morcos
e587bc3fd9 Implement helper class for CTxMemPoolEntry constructor
This is only for unit tests.
2015-11-16 20:41:32 -05:00
Gregory Maxwell
87ee0e2dbc
Merge pull request #6986
6bc9e40 Chainparams: Explicit CChainParams arg for miner: (Jorge Timón)
598e494 Chainparams: Explicit CChainParams arg for main (pre miner): (Jorge Timón)
2015-11-16 17:00:11 -08:00
Alex Morcos
e93a236d7a add estimateSmartFee to the unit test 2015-11-16 15:33:06 -05:00
Alex Morcos
f22ac4a22c Increase success threshold for fee estimation to 95%
This provides more conservative estimates and reacts more quickly to a backlog.
Unfortunately the unit test for fee estimation depends on the success threshold (and the decay) chosen; also modify the unit test for the new default success thresholds.
2015-11-16 15:33:06 -05:00
Pieter Wuille
6e18268616 Switch to libsecp256k1-based validation for ECDSA 2015-11-15 16:06:57 +01:00
Pieter Wuille
114b5812f6 Prevector type 2015-11-13 18:15:20 +01:00
Alex Morcos
a78e6eaf5c Fix bug in mempool_tests unit test 2015-11-13 10:50:49 -05:00
Alex Morcos
1cf3dd80a6 Add unit test for UpdateCoins 2015-11-12 09:55:12 -05:00
Alex Morcos
03c82826f9 Make CCoinsViewTest behave like CCoinsViewDB 2015-11-11 21:19:19 -05:00
Jorge Timón
6bc9e4056b Chainparams: Explicit CChainParams arg for miner:
-BitcoinMiner
-CreateNewBlock
-GenerateBitcoins
-ProcessBlockFound
2015-11-11 13:21:17 +01:00
Jorge Timón
598e494587 Chainparams: Explicit CChainParams arg for main (pre miner):
-ProcessNewBlock
-TestBlockValidity
2015-11-11 13:21:17 +01:00
MarcoFalke
536766c903 [trivial] New DEFAULT_MIN_RELAY_TX_FEE = 1000 2015-11-09 21:00:16 +01:00
MarcoFalke
5f46a7d068 transaction_tests: Be more strict checking dust
* Don't allow off-by-one or more
* Make clear dust is coupled with minRelayTxFee
* Check rounding for odd values
2015-11-09 21:00:16 +01:00
Gregory Maxwell
d1c3762ae8 Revert "Revert "Enable policy enforcing GetMedianTimePast as the end point of lock-time constraints""
This reverts commit 8537ecdfc4.
2015-11-03 17:14:09 +00:00
Wladimir J. van der Laan
8fe30fb4d1
Merge pull request #6928
40cd32e Revert "Add rules--presently disabled--for using GetMedianTimePast as endpoint for lock-time calculations" (Gregory Maxwell)
8537ecd Revert "Enable policy enforcing GetMedianTimePast as the end point of lock-time constraints" (Gregory Maxwell)
2015-11-02 04:44:47 +01:00
Gregory Maxwell
8537ecdfc4 Revert "Enable policy enforcing GetMedianTimePast as the end point of lock-time constraints"
This reverts commit dea8d21fc6.
2015-11-01 20:05:16 +00:00
Wladimir J. van der Laan
7497e805bd tests: Initialize networking on windows 2015-11-01 11:45:06 +01:00
Daniel Kraft
0be387a536 unittest: fix test for null tx input
Update the unittest that is meant to catch a transaction that is invalid
because it has a null input.  The old test failed not because of that
but because it was considered a coinbase with too large script.  This is
already checked with a different test, though.

The new test is *not* a coinbase since it has two inputs, but one of
them is null.  This really checks the corresponding code path in
CheckTransaction.
2015-10-27 20:11:56 +01:00
Wladimir J. van der Laan
c8322ff7f7
Merge pull request #6888
143d173 Use BOOST_CHECK_MESSAGE() rather than BOOST_CHECK() in alerts_tests.cpp and initialize strMiscWarning before calling PartitionCheck()." (Eric Lombrozo)
2015-10-26 17:25:19 +01:00
Eric Lombrozo
143d173969 Use BOOST_CHECK_MESSAGE() rather than BOOST_CHECK() in alerts_tests.cpp and initialize strMiscWarning before calling PartitionCheck()." 2015-10-25 05:47:02 -04:00
Mark Friedenbach
dea8d21fc6 Enable policy enforcing GetMedianTimePast as the end point of lock-time constraints
Transactions are not allowed in the memory pool or selected for inclusion in a block until their lock times exceed chainActive.Tip()->GetMedianTimePast(). However blocks including transactions which are only mature under the old rules are still accepted; this is *not* the soft-fork required to actually rely on the new constraint in production.
2015-10-23 09:02:24 -07:00
Jeff Garzik
46f74379b8
Merge pull request #6873 2015-10-23 09:01:22 -04:00
Jeff Garzik
3795e8152b leveldbwrapper file rename to dbwrapper.* 2015-10-22 21:33:06 -04:00
Jeff Garzik
8587b23038 leveldbwrapper symbol rename: Remove "Level" from class, etc. names 2015-10-22 21:02:20 -04:00
Wladimir J. van der Laan
f2c869aef2
Merge pull request #6848
c6824f8 Add DERSIG transaction test cases (J Ross Nicoll)
2015-10-22 18:02:17 +02:00
Wladimir J. van der Laan
3b20e239c6
Merge pull request #6722
58254aa Fix stale comment in CTxMemPool::TrimToSize. (Matt Corallo)
2bc5018 Fix comment formatting tabs (Matt Corallo)
8abe0f5 Undo GetMinFee-requires-extra-call-to-hit-0 (Matt Corallo)
9e93640 Drop minRelayTxFee to 1000 (Matt Corallo)
074cb15 Add reasonable test case for mempool trimming (Matt Corallo)
d355cf4 Only call TrimToSize once per reorg/blocks disconnect (Matt Corallo)
794a8ce Implement on-the-fly mempool size limitation. (Matt Corallo)
e6c7b36 Print mempool size in KB when adding txn (Matt Corallo)
241d607 Add CFeeRate += operator (Matt Corallo)
e8bcdce Track (and define) ::minRelayTxFee in CTxMemPool (Matt Corallo)
9c9b66f Fix calling mempool directly, instead of pool, in ATMP (Matt Corallo)
49b6fd5 Add Mempool Expire function to remove old transactions (Pieter Wuille)
78b82f4 Reverse the sort on the mempool's feerate index (Suhas Daftuar)
2015-10-21 08:50:16 +02:00
Wladimir J. van der Laan
e26a3f6713
Merge pull request #6235
55a8975 Chainparams: Translations: DRY: options and error strings (Jorge Timón)
f3525e2 Chainparams: Replace CBaseChainParams::Network enum with string constants (suggested by Wladimir) (Jorge Timón)
2015-10-20 17:06:28 +02:00
Jorge Timón
f3525e24e3 Chainparams: Replace CBaseChainParams::Network enum with string constants (suggested by Wladimir) 2015-10-20 14:22:44 +02:00
J Ross Nicoll
c6824f8a90 Add DERSIG transaction test cases
Add test cases for DERSIG flag enforcement against transactions.
2015-10-18 17:27:41 +01:00
Matt Corallo
8abe0f5658 Undo GetMinFee-requires-extra-call-to-hit-0 2015-10-14 12:44:18 -07:00
Wladimir J. van der Laan
9caaf6ed22
Merge pull request #6777
dcd8e27 Refer to obfuscate_key via pointer in peripheral CLevelDB classes (James O'Beirne)
1488506 Add tests for gettxoutsetinfo, CLevelDBBatch, CLevelDBIterator (James O'Beirne)
0fdf8c8 Handle obfuscation in CLevelDBIterator (James O'Beirne)
3499ce1 Encapsulate CLevelDB iterators cleanly (Pieter Wuille)
2015-10-13 12:23:45 +02:00
Wladimir J. van der Laan
01f74999e3
Merge pull request #6798
700f52e Clarification of unit test build instructions. (Eric Lombrozo)
2015-10-13 11:35:24 +02:00
Matt Corallo
074cb155c2 Add reasonable test case for mempool trimming 2015-10-13 01:39:38 -07:00
Matt Corallo
d355cf4420 Only call TrimToSize once per reorg/blocks disconnect 2015-10-13 01:39:38 -07:00
Suhas Daftuar
78b82f4a16 Reverse the sort on the mempool's feerate index 2015-10-13 00:44:03 -07:00
Wladimir J. van der Laan
4e2efb3c5f tests: update transaction_tests for new dust threshold 2015-10-10 14:49:38 +02:00
Eric Lombrozo
700f52e0f6 Clarification of unit test build instructions. 2015-10-10 06:46:35 -04:00
James O'Beirne
dcd8e27c65 Refer to obfuscate_key via pointer in peripheral CLevelDB classes
cc @sipa
2015-10-09 10:56:48 -07:00
James O'Beirne
1488506872 Add tests for gettxoutsetinfo, CLevelDBBatch, CLevelDBIterator
Thanks @dexX7.
2015-10-09 10:56:39 -07:00
Wladimir J. van der Laan
d479311dba
Merge pull request #6720
1534d9a Creates unittests for addrman, makes addrman testable. Adds several unittests for addrman to verify it works as expected. Makes small modifications to addrman to allow deterministic and targeted tests. (EthanHeilman)
2015-10-07 14:59:58 +02:00
Wladimir J. van der Laan
4fac576c61
Merge pull request #6650
42cb388 Add chainstate obfuscation to avoid spurious antivirus detection (James O'Beirne)
2015-10-06 17:50:46 +02:00
James O'Beirne
42cb388167 Add chainstate obfuscation to avoid spurious antivirus detection
Adds an `obfuscate` parameter to `CLevelDBWrapper` and makes use of it
for all new chainstate stores built via `CCoinsViewDB`. Also adds an
`Xor` method to `CDataStream`.

Thanks to @sipa @laanwj @pstratem @dexX7 @KyrosKrane @gmaxwell.
2015-10-06 07:46:10 -07:00
Peter Todd
da894ab5da Accept any sequence of PUSHDATAs in OP_RETURN outputs
Previously only one PUSHDATA was allowed, needlessly limiting
applications such as matching OP_RETURN contents with bloom filters that
operate on a per-PUSHDATA level. Now any combination that passes
IsPushOnly() is allowed, so long as the total size of the scriptPubKey
is less than 42 bytes. (unchanged modulo non-minimal PUSHDATA encodings)

Also, this fixes the odd bug where previously the PUSHDATA could be
replaced by any single opcode, even sigops consuming opcodes such as
CHECKMULTISIG. (20 sigops!)
2015-10-01 18:28:13 +02:00
Jonas Schnelli
9623e93473 [Univalue] add univalue over subtree
similar to secp256k1 include and compile univalue over a subtree
2015-10-01 10:49:57 +02:00
Wladimir J. van der Laan
f6ce59cd3c
Merge pull request #6713
43edd51 SanitizeString: Allow hypen char (MarcoFalke)
2015-09-30 00:23:26 +02:00
Wladimir J. van der Laan
48efbdbe98
Merge pull request #5264
af3208b Resolve issue 3166. These changes decode valid SIGHASH types on signatures in assembly (asm) representations of scriptSig scripts. This squashed commit incorporates substantial helpful feedback from jtimon, laanwj, and sipa. (mruddy)
2015-09-25 19:19:07 +02:00
EthanHeilman
1534d9a83c Creates unittests for addrman, makes addrman testable.
Adds several unittests for addrman to verify it works as expected.
Makes small modifications to addrman to allow deterministic and targeted tests.
2015-09-24 15:20:48 -04:00
MarcoFalke
43edd515e5 SanitizeString: Allow hypen char 2015-09-23 12:06:00 +02:00
Pieter Wuille
391dff16fe Do not store Merkle branches in the wallet.
Assume that when a wallet transaction has a valid block hash and transaction position
in it, the transaction is actually there. We're already trusting wallet data in a
much more fundamental way anyway.

To prevent backward compatibility issues, a new record is used for storing the
block locator in the wallet. Old wallets will see a wallet file synchronized up
to the genesis block, and rescan automatically.
2015-09-22 18:51:07 +02:00
Wladimir J. van der Laan
e59d2a80f9
Merge pull request #6315
7aac6db [QT] dump banlist to disk in case of ban/unban over QT (Jonas Schnelli)
7f90ea7 [QA] adabt QT_NO_KEYWORDS for QT ban implementation (Jonas Schnelli)
07f70b2 [QA] fix netbase tests because of new CSubNet::ToString() output (Jonas Schnelli)
4ed0510 [Qt] call DumpBanlist() when baning unbaning nodes (Philip Kaufmann)
be89292 [Qt] reenabling hotkeys for ban context menu, use different words (Jonas Schnelli)
b1189cf [Qt] adapt QT ban option to banlist.dat changes (Jonas Schnelli)
65abe91 [Qt] add sorting for bantable (Philip Kaufmann)
51654de [Qt] bantable polish (Philip Kaufmann)
cdd72cd [Qt] simplify ban list signal handling (Philip Kaufmann)
43c1f5b [Qt] remove unused timer-code from banlistmodel.cpp (Jonas Schnelli)
e2b8028 net: Fix CIDR notation in ToString() (Wladimir J. van der Laan)
9e521c1 [Qt] polish ban table (Philip Kaufmann)
607809f net: use CIDR notation in CSubNet::ToString() (Jonas Schnelli)
53caec6 [Qt] bantable overhaul (Jonas Schnelli)
f0bcbc4 [Qt] bantable fix timestamp 64bit issue (Jonas Schnelli)
6135309 [Qt] banlist, UI optimizing and better signal handling (Jonas Schnelli)
770ca79 [Qt] add context menu with unban option to ban table (Jonas Schnelli)
5f42132 [Qt] add ui signal for banlist changes (Jonas Schnelli)
ad204df [Qt] add banlist table below peers table (Jonas Schnelli)
50f0908 [Qt] add ban functions to peers window (Jonas Schnelli)
2015-09-22 13:39:38 +02:00
Wladimir J. van der Laan
a3babc826d
Merge pull request #6647
1c1b1b3 [uacomment] Sanitize per BIP-0014 (MarcoFalke)
2015-09-22 11:36:50 +02:00
Suhas Daftuar
5add7a74a6 Track transaction packages in CTxMemPoolEntry
Associate with each CTxMemPoolEntry all the size/fees of descendant
mempool transactions.  Sort mempool by max(feerate of entry, feerate
of descendants).  Update statistics on-the-fly as transactions enter
or leave the mempool.

Also add ancestor and descendant limiting, so that transactions can
be rejected if the number or size of unconfirmed ancestors exceeds
a target, or if adding a transaction would cause some other mempool
entry to have too many (or too large) a set of unconfirmed in-
mempool descendants.
2015-09-19 13:25:48 -04:00
Ashley Holman
34628a1807 TxMemPool: Change mapTx to a boost::multi_index_container
Indexes on:
- Tx Hash
- Fee Rate (fee-per-kb)
2015-09-19 13:22:40 -04:00
Jonas Schnelli
07f70b2dde [QA] fix netbase tests because of new CSubNet::ToString() output 2015-09-16 16:50:20 +02:00
Wladimir J. van der Laan
e2b8028e4c net: Fix CIDR notation in ToString()
Only use CIDR notation if the netmask can be represented as such.
2015-09-16 16:50:19 +02:00
Jonas Schnelli
607809f037 net: use CIDR notation in CSubNet::ToString() 2015-09-16 16:50:19 +02:00
MarcoFalke
1c1b1b315f [uacomment] Sanitize per BIP-0014
* SanitizeString() can be requested to be more strict
* Throw error when SanitizeString() changes uacomments
* Fix tests
2015-09-16 15:23:29 +02:00
Wladimir J. van der Laan
9aa90994ee
Merge pull request #5677
d528025 Revert "rpc-tests: re-enable rpc-tests for Windows" (Wladimir J. van der Laan)
1e700c9 doc: update deps in build-unix.md after libevent (Wladimir J. van der Laan)
26c9b83 Move windows socket init to utility function (Wladimir J. van der Laan)
4be0b08 libevent: Windows reuseaddr workaround in depends (Cory Fields)
3a174cd Fix race condition between starting HTTP server thread and setting EventBase() (Wladimir J. van der Laan)
6d2bc22 Document options for new HTTP/RPC server in --help (Wladimir J. van der Laan)
be33f3f Implement RPCTimerHandler for Qt RPC console (Wladimir J. van der Laan)
57d85d9 doc: mention SSL support dropped for RPC in release notes (Wladimir J. van der Laan)
40b556d evhttpd implementation (Wladimir J. van der Laan)
ee2a42b tests: GET requests cannot have request body, use POST in rest.py (Wladimir J. van der Laan)
6e996d3 tests: fix qt payment test (Cory Fields)
3140ef9 build: build-system changes for libevent (Wladimir J. van der Laan)
a9af234 libevent: add depends (Cory Fields)
6a21dd5 Remove rpc_boostasiotocnetaddr test (Wladimir J. van der Laan)
8f9301c qa: Remove -rpckeepalive tests from httpbasics (Wladimir J. van der Laan)
51fcfc0 doc: remove documentation for rpcssl (Wladimir J. van der Laan)
2015-09-04 13:06:32 +02:00
Casey Rodarmor
86270c8164 Replace boost::reverse_lock with our own. 2015-09-03 15:13:40 -04:00
Wladimir J. van der Laan
6a21dd598c Remove rpc_boostasiotocnetaddr test
Dropping all use of boost::asio.
2015-09-02 18:38:41 +02:00
Wladimir J. van der Laan
da9beb288d
Merge pull request #6576
e938122 Stop parsing JSON after first finished construct. (Daniel Kraft)
2015-08-24 13:44:05 +02:00
Wladimir J. van der Laan
e3f13ddc54
Merge pull request #6242
17221bf chainparams: don't use std namespace (Cory Fields)
f0deec5 chainparams: move CCheckpointData into chainparams.h (Cory Fields)
2015-08-20 18:26:26 +02:00
Wladimir J. van der Laan
70ec975ea6
Merge pull request #6556
1123cdb add unit test for CNetAddr::GetGroup. (Alex Morcos)
bba3db1 Fix masking of irrelevant bits in address groups. (Alex Morcos)
2015-08-20 16:45:46 +02:00
Daniel Kraft
e938122b7b Stop parsing JSON after first finished construct.
Fix https://github.com/bitcoin/bitcoin/issues/6558.  In particular, stop
parsing JSON after the first object or array is finished.  Check that no
other garbage follows, and fail the parser if it does.
2015-08-20 12:48:43 +02:00
Alex Morcos
1123cdbf4d add unit test for CNetAddr::GetGroup. 2015-08-19 17:06:42 -04:00
Wladimir J. van der Laan
ef30389e2a
Merge pull request #6544
c5c1edf Fix spelling mistake in -> if. (Mark Friedenbach)
e846b2a Correct a possibly intentional pun that is nevertheless hard to read: "two times of nLockTime." What is meant is that there are two kinds, or categories of nLockTime. (Mark Friedenbach)
2015-08-19 17:37:52 +02:00
Wladimir J. van der Laan
80cddbbba9
Merge pull request #6539
9f68ed6 typofixes (found by misspell_fixer) (Veres Lajos)
2015-08-19 17:28:00 +02:00
Casey Rodarmor
7bd57bb1d7 Add limitedmap test 2015-08-17 12:15:32 -04:00
Mark Friedenbach
c5c1edfe60 Fix spelling mistake in -> if. 2015-08-10 18:09:59 -07:00
Veres Lajos
9f68ed6b6d typofixes (found by misspell_fixer) 2015-08-10 22:06:27 +01:00
Wladimir J. van der Laan
6bb28058d3
Merge pull request #6346
627468d Add support for data-based outputs (OP_RETURN) to bitcoin-tx. (Pavel Janík)
d707853 Add OP_RETURN support in createrawtransaction RPC call, add tests. (Pavel Janík)
2015-08-10 17:53:07 +02:00
Cory Fields
605433ffb5 locks: don't lock cs_wallet before making rpc calls 2015-08-07 16:17:57 -04:00
Pavel Janík
627468d2ea Add support for data-based outputs (OP_RETURN) to bitcoin-tx. 2015-08-06 20:27:52 +02:00
Pavel Janík
d7078533eb Add OP_RETURN support in createrawtransaction RPC call, add tests. 2015-08-06 20:27:52 +02:00
Casey Rodarmor
231c5601a1 Use unique name for AlertNotify tempfile 2015-08-05 23:12:26 -04:00
Wladimir J. van der Laan
219b916545
Merge pull request #6498
a8d0407 Move recentRejects initialization to top of InitBlockIndex (Wladimir J. van der Laan)
0847d9c Keep track of recently rejected transactions (Peter Todd)
d741371 Only use randomly created nonces in CRollingBloomFilter. (Pieter Wuille)
d2d7ee0 Make CRollingBloomFilter set nTweak for you (Peter Todd)
a3d65fe Reuse vector hashing code for uint256 (Pieter Wuille)
bbe4108 Add uint256 support to CRollingBloomFilter (Peter Todd)
2015-08-03 20:13:43 +02:00
Wladimir J. van der Laan
10ac38ed9f
Merge pull request #6284
c6455c7 doc: mention change to option parsing behavior in release notes (Wladimir J. van der Laan)
c38c49d Fix argument parsing oddity with -noX (Wladimir J. van der Laan)
2015-08-03 19:54:52 +02:00
mruddy
af3208bfa6 Resolve issue 3166.
These changes decode valid SIGHASH types on signatures in assembly (asm) representations of scriptSig scripts.
This squashed commit incorporates substantial helpful feedback from jtimon, laanwj, and sipa.
2015-07-30 19:56:00 -04:00
Cory Fields
f0deec572b chainparams: move CCheckpointData into chainparams.h
This unties CChainParams from its dependency on checkpoints. Instead, now it
only depends on the raw checkpoint data.
2015-07-28 15:26:50 -04:00
Pieter Wuille
eddaba7b56
Revert "Cache transaction validation successes"
This reverts commit 17b11428c1.
2015-07-28 20:15:00 +02:00
Pieter Wuille
d741371d7d Only use randomly created nonces in CRollingBloomFilter. 2015-07-27 19:09:39 +02:00
Peter Todd
d2d7ee0e86 Make CRollingBloomFilter set nTweak for you
While CBloomFilter is usually used with an explicitly set nTweak,
CRollingBloomFilter is only used internally. Requiring every caller to
set nTweak is error-prone and redundant; better to have the class handle
that for you with a high-quality randomness source.

Additionally when clearing the filter it makes sense to change nTweak as
well to recover from a bad setting, e.g. due to insufficient randomness
at initialization, so the clear() method is replaced by a reset() method
that sets a new, random, nTweak value.
2015-07-27 18:38:49 +02:00
Gavin Andresen
517e6dd256 Unit test doublespends in new blocks
As suggested by Greg Maxwell-- unit test to make sure a block
with a double-spend in it doesn't pass validation if half of
the double-spend is already in the memory pool (so full-blown
transaction validation is skipped) when the block is received.
2015-07-27 15:50:21 +02:00
Pieter Wuille
17b11428c1 Cache transaction validation successes 2015-07-27 15:28:43 +02:00
Wladimir J. van der Laan
c38c49d0b7 Fix argument parsing oddity with -noX
`bitcoind -X -noX` ends up, unintuitively, with `X` set.
(for all boolean options X)

This result is due to the odd two-pass processing of arguments. This
patch fixes this oddity and simplifies the code at the same time.
2015-07-27 14:47:54 +02:00
Wladimir J. van der Laan
ca37e0f339
Merge pull request #5697
60c8bac Includes: Cleanup around net main and wallet (Jorge Timón)
9dd793f TRIVIAL: Missing includes (Jorge Timón)
2015-07-27 14:40:29 +02:00
Wladimir J. van der Laan
d43297c5ba
Merge pull request #6468
6f8b6d3 don't try to decode invalid encoded ext keys (Jonas Schnelli)
8d2af54 extend bip32 tests to cover Base58c/CExtKey decode (Jonas Schnelli)
7cb1f9f fix and extend CBitcoinExtKeyBase template (Jonas Schnelli)
2015-07-27 13:20:54 +02:00
Wladimir J. van der Laan
bfd807ff32
Merge pull request #6456
ec249d4 util: use locale-independent parsing in ParseDouble (Wladimir J. van der Laan)
7650449 univalue: Avoid unnecessary roundtrip through double for numbers (Wladimir J. van der Laan)
e061e27 rpc: Make ValueFromAmount always return 8 decimals (Wladimir J. van der Laan)
2015-07-24 11:08:52 +02:00
Jorge Timón
60c8bac77c Includes: Cleanup around net main and wallet
-Move from .h to .cpp: in main, net and wallet
-Remove unnecessary #include "main.h"
-Cleanup some wallet files includes
2015-07-23 21:10:26 +02:00
Jorge Timón
9dd793f499 TRIVIAL: Missing includes 2015-07-23 21:10:22 +02:00