Commit graph

117 commits

Author SHA1 Message Date
Ross Nicoll 9c3a11b248 Clean up RPC tests (#1465)
* Enable full block tests
* Fix invalidblocktest
* Move watch only address funding to immediately before it's used, so node 0 doesn't spend the output before it checks it later.
* Fix `fundrawtransaction` tests and sanitize fee calculation at the same time
* Correct resolution of chain parameters when validating tx inputs, especially from previous coinbase transactions
* Set block versions on full block tests so that the generated blocks are AuxPoW compatible
2018-09-19 22:11:47 +01:00
Ross Nicoll 1be681a1b9 Modify chain consensus parameters to be height aware (#1396)
* Modify chain consensus parameters to be height aware
* Correct implementation of simplified rewards in parameters
* Correct max money
* Use base block version in IsSuperMajority() instead of full version
* Correct mining of blocks in AuxPoW tests
* Add in missing pre-AuxPoW consensus checks
2018-09-19 19:24:06 +01:00
Ross Nicoll fcde864334 Sync mining code from Namecore to resolve unit test failures (#1385) 2018-09-19 19:23:29 +01:00
Ross Nicoll 3cff8e9773 Replace test data with Dogecoin values
Replace test data with Dogecoin equivalents in the folowing tests:

* base58
* bip32
* keys
* miner
* pow

Replace RPC and deterministic signatures in unit tests with Dogecoin values. While
conventionally I'd use an alternative implementation for these, as RFC 6979
compliant signature generation isn't terribly common, and there's no reason
to suspect we've modified this code, I'm going to assert that it's good enough
to test that the code doesn't provide different values.

Disabled Bitcoin PoW tests, but left code in place to simplify later merges. These are
replaced by the Dogecoin PoW tests.
2018-09-19 19:21:49 +01:00
Lauda 5c66d41b7f [Trivial] Grammar and typo correction
Minor corrections in src\test\* .
2017-01-22 13:18:51 +01:00
Alex Morcos 84f7ab08d2 Remove member variable hadNoDependencies from CTxMemPoolEntry
Fee estimation can just check its own mapMemPoolTxs to determine the same information.  Note that now fee estimation for block processing must happen before those transactions are removed, but this shoudl be a speedup.
2017-01-04 12:09:33 -05:00
Wladimir J. van der Laan 869781c51c
Merge #9283: A few more CTransactionRef optimizations
91335ba Remove unused MakeTransactionRef overloads (Pieter Wuille)
6713f0f Make FillBlock consume txn_available to avoid shared_ptr copies (Pieter Wuille)
62607d7 Convert COrphanTx to keep a CTransactionRef (Pieter Wuille)
c44e4c4 Make AcceptToMemoryPool take CTransactionRef (Pieter Wuille)
2017-01-04 12:23:10 +01:00
isle2983 27765b6403 Increment MIT Licence copyright header year on files modified in 2016
Edited via:

$ contrib/devtools/copyright_header.py update .
2016-12-31 11:01:21 -07:00
Matt Corallo c2f61bebb1 Add a ForceSetArg method for testing 2016-12-27 13:52:07 +01:00
Matt Corallo 4cd373aea8 Un-expose mapArgs from utils.h 2016-12-24 11:29:33 -05:00
Pieter Wuille c44e4c467c Make AcceptToMemoryPool take CTransactionRef 2016-12-21 18:18:23 -08:00
Pieter Wuille b83264d9c7
Merge #8895: Better SigCache Implementation
67dac4e Add unit tests for the CuckooCache (Jeremy Rubin)
c9e69fb Add CuckooCache implementation and replace the sigcache map_type with it (Jeremy Rubin)
2016-12-14 18:14:02 -08:00
Jeremy Rubin c9e69fbf39 Add CuckooCache implementation and replace the sigcache map_type with it
SQUASHME: Change cuckoocache to only work for powers of two, to avoid mod operator
SQUASHME: Update Documentation and simplify logarithm logic
SQUASHME: OSX Build Errors
SQUASHME: minor Feedback from sipa + bluematt
SQUASHME: DOCONLY: Clarify a few comments.
2016-12-14 16:02:05 -05:00
Matt Corallo a13fa4c80f Remove unused CDiskBlockPos* argument from ProcessNewBlock 2016-12-04 00:23:17 -08:00
Matt Corallo 2d6e5619af Switch pblock in ProcessNewBlock to a shared_ptr
This (finally) fixes a performance regression in
b3b3c2a562
2016-12-04 00:17:30 -08:00
Matt Corallo 76faa3cdfe Rename the remaining main.{h,cpp} to validation.{h,cpp} 2016-12-02 09:42:51 -08:00
Matt Corallo e736772c56 Move network-msg-processing code out of main to its own file 2016-12-02 09:42:51 -08:00
Pieter Wuille b4e4ba475a Introduce convenience type CTransactionRef 2016-11-19 17:53:23 -08:00
Pieter Wuille 1662b437b3 Make CBlock::vtx a vector of shared_ptr<CTransaction> 2016-11-19 17:51:09 -08:00
Matt Corallo ae22357607 Replace CValidationState param in ProcessNewBlock with BlockChecked 2016-11-09 11:21:55 -08:00
Matt Corallo 7c98ce584e Remove pfrom parameter from ProcessNewBlock
This further decouples ProcessNewBlock from networking/peer logic.
2016-11-09 11:21:45 -08:00
Suhas Daftuar 88c35491ab Fix compact block handling to not ban if block is invalid 2016-11-03 13:07:12 -04:00
Wladimir J. van der Laan 05998da5a7
Merge #8865: Decouple peer-processing-logic from block-connection-logic
a9aec5c Use BlockChecked signal to send reject messages from mapBlockSource (Matt Corallo)
7565e03 Remove SyncWithWallets wrapper function (Matt Corallo)
12ee1fe Always call UpdatedBlockTip, even if blocks were only disconnected (Matt Corallo)
f5efa28 Remove CConnman parameter from ProcessNewBlock/ActivateBestChain (Matt Corallo)
fef1010 Use CValidationInterface from chain logic to notify peer logic (Matt Corallo)
aefcb7b Move net-processing logic definitions together in main.h (Matt Corallo)
0278fb5 Remove duplicate nBlocksEstimate cmp (we already checked IsIBD()) (Matt Corallo)
87e7d72 Make validationinterface.UpdatedBlockTip more verbose (Matt Corallo)
2016-10-18 22:48:51 +02:00
Wladimir J. van der Laan 744d2652dd
Merge #8223: [c++11] Use std::unique_ptr for block creation.
9fce062 [c++11] Use std::unique_ptr for block creation. (Daniel Kraft)
2016-10-18 21:16:08 +02:00
Wladimir J. van der Laan 5eaaa83ac1 Kill insecure_random and associated global state
There are only a few uses of `insecure_random` outside the tests.
This PR replaces uses of insecure_random (and its accompanying global
state) in the core code with an FastRandomContext that is automatically
seeded on creation.

This is meant to be used for inner loops. The FastRandomContext
can be in the outer scope, or the class itself, then rand32() is used
inside the loop. Useful e.g. for pushing addresses in CNode or the fee
rounding, or randomization for coin selection.

As a context is created per purpose, thus it gets rid of
cross-thread unprotected shared usage of a single set of globals, this
should also get rid of the potential race conditions.

- I'd say TxMempool::check is not called enough to warrant using a special
  fast random context, this is switched to GetRand() (open for
  discussion...)

- The use of `insecure_rand` in ConnectThroughProxy has been replaced by
  an atomic integer counter. The only goal here is to have a different
  credentials pair for each connection to go on a different Tor circuit,
  it does not need to be random nor unpredictable.

- To avoid having a FastRandomContext on every CNode, the context is
  passed into PushAddress as appropriate.

There remains an insecure_random for test usage in `test_random.h`.
2016-10-17 13:08:35 +02:00
Matt Corallo f5efa28393 Remove CConnman parameter from ProcessNewBlock/ActivateBestChain 2016-10-04 13:51:32 -04:00
Pieter Wuille d9ff591d42 Move static global randomizer seeds into CConnman 2016-09-19 15:53:47 +02:00
Cory Fields 8d58c4d81f net: Pass CConnman around as needed 2016-09-08 12:04:35 -04:00
Cory Fields cd16f48028 net: Create CConnman to encapsulate p2p connections 2016-09-08 12:04:35 -04:00
Pieter Wuille 0fd2a33648 Use a signal to continue init after genesis activation 2016-07-30 02:17:47 +02:00
Pieter Wuille 2b1f6f9ccf BIP141: Other consensus critical limits, and BIP145
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
2016-06-22 15:43:00 +02:00
Wladimir J. van der Laan e9d76a161d
Merge #8068: Compact Blocks
48efec8 Fix some minor compact block issues that came up in review (Matt Corallo)
ccd06b9 Elaborate bucket size math (Pieter Wuille)
0d4cb48 Use vTxHashes to optimize InitData significantly (Matt Corallo)
8119026 Provide a flat list of txid/terators to txn in CTxMemPool (Matt Corallo)
678ee97 Add BIP 152 to implemented BIPs list (Matt Corallo)
56ba516 Add reconstruction debug logging (Matt Corallo)
2f34a2e Get our "best three" peers to announce blocks using cmpctblocks (Matt Corallo)
927f8ee Add ability to fetch CNode by NodeId (Matt Corallo)
d25cd3e Add receiver-side protocol implementation for CMPCTBLOCK stuff (Matt Corallo)
9c837d5 Add sender-side protocol implementation for CMPCTBLOCK stuff (Matt Corallo)
00c4078 Add protocol messages for short-ids blocks (Matt Corallo)
e3b2222 Add some blockencodings tests (Matt Corallo)
f4f8f14 Add TestMemPoolEntryHelper::FromTx version for CTransaction (Matt Corallo)
85ad31e Add partial-block block encodings API (Matt Corallo)
5249dac Add COMPACTSIZE wrapper similar to VARINT for serialization (Matt Corallo)
cbda71c Move context-required checks from CheckBlockHeader to Contextual... (Matt Corallo)
7c29ec9 If AcceptBlockHeader returns true, pindex will be set. (Matt Corallo)
96806c3 Stop trimming when mapTx is empty (Pieter Wuille)
2016-06-22 14:30:38 +02:00
Matt Corallo f4f8f14adc Add TestMemPoolEntryHelper::FromTx version for CTransaction 2016-06-19 01:34:57 -07:00
Daniel Kraft 9fce0629b4 [c++11] Use std::unique_ptr for block creation.
CreateNewBlock returns a pointer for which the caller takes ownership.
Use std::unique_ptr to make this explicit and simplify handling of these
objects in getblocktemplate.
2016-06-18 19:38:28 +02:00
Pieter Wuille 3775ff9ea7 Enable mempool consistency checks in unit tests 2016-06-18 19:15:03 +02:00
Alex Morcos 4dc94d1036 Refactor CreateNewBlock to be a method of the BlockAssembler class 2016-05-18 14:11:12 -04:00
Wladimir J. van der Laan 04a2937357
Merge #7787: [Moveonly] Create ui_interface.cpp
fa10ce6 Move ui_interface.cpp to libbitcoin_server_a_SOURCES (MarcoFalke)
fabbf80 [ui] Move InitError, InitWarning, AmountErrMsg (MarcoFalke)
2016-04-19 16:10:57 +02:00
Wladimir J. van der Laan f4eae2d910 test: Create test fixture for wallet
Removes all the `#ifdef ENABLE_WALLET` from `test_bitcoin` by
making the wallet tests use their own fixture.
2016-04-18 14:57:42 +02:00
MarcoFalke fabbf80f2f [ui] Move InitError, InitWarning, AmountErrMsg 2016-04-02 15:26:21 +02:00
Wladimir J. van der Laan 30c2dd8d05
Merge #7691: [Wallet] refactor wallet/init interaction
25340b7 [Wallet] refactor wallet/init interaction (Jonas Schnelli)
2016-04-02 11:07:39 +02:00
Wladimir J. van der Laan fb8a8cf2e6 rpc: Register calls where they are defined
Split out methods to every module, apart from 'help' and 'stop' which
are implemented in rpcserver.cpp itself.

- This makes it easier to add or remove RPC commands - no longer everything that includes
    rpcserver.h has to be rebuilt when there's a change there.
- Cleans up `rpc/server.h` by getting rid of the huge cluttered list of function definitions.
- Removes most of the bitcoin-specific code from rpcserver.cpp and .h.

Continues #7307 for the non-wallet.
2016-03-31 10:48:32 +02:00
Jonas Schnelli 25340b7cd5
[Wallet] refactor wallet/init interaction 2016-03-22 08:20:59 +01:00
Wladimir J. van der Laan 14d6324a24
Merge #7187: Keep reorgs fast for SequenceLocks checks
982670c Add LockPoints (Alex Morcos)
2016-03-16 21:20:04 +01:00
Alex Morcos 982670c333 Add LockPoints
Obtain LockPoints to store in CTxMemPoolEntry and during a reorg, evaluate whether they are still valid and if not, recalculate them.
2016-03-16 16:11:46 -04:00
Mustafa 2fdaa25529 Move GetTempPath() to testutil. 2016-03-11 15:04:05 +00: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
MarcoFalke fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01: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
Suhas Daftuar 7e49f5f8b4 Track coinbase spends in CTxMemPoolEntry
This allows us to optimize CTxMemPool::removeForReorg.
2015-11-30 13:12:53 -05: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