Commit Graph

187 Commits

Author SHA1 Message Date
Jon Layton 2a63c34936 Merge remote-tracking branch 'btc/master' into upstream-merge 2018-10-16 22:27:53 -05:00
MarcoFalke fa69ac7614
doxygen: Fix member comments 2018-09-26 15:42:21 -04:00
MarcoFalke faa1a74942
tx pool: Use class methods to hide raw map iterator impl details 2018-09-07 13:04:02 -04:00
Wladimir J. van der Laan 888acefa5e
Merge #13792: tx pool: Avoid passing redundant hash into addUnchecked (scripted-diff)
fa587773e5 scripted-diff: Remove unused first argument to addUnchecked (MarcoFalke)
fe5c49766c tx pool: Use the entry's hash instead of the one passed to addUnchecked (MarcoFalke)
ddd395f968 Mark CTxMemPoolEntry members that should not be modified const (MarcoFalke)

Pull request description:

  Several years ago the transaction hash was not cached. For optimization the hash was instead passed into `addUnchecked` to avoid re-calculating it. See f77654a0e9

  Passing in the hash is now redundant and the argument can safely be removed.

Tree-SHA512: 0206b65c7a014295f67574120e8c5397bf1b1bd70c918ae1360ab093676f7f89a6f084fd2c7000a141baebfe63fe6f515559e38c4ac71810ba64f949f9c0467f
2018-08-29 16:30:58 +02:00
practicalswift 9e2de6b9d0 Move cs_main locking annotations from .cpp to .h 2018-08-26 11:15:17 +02:00
Wladimir J. van der Laan 78dae8cacc
Merge #13780: 0.17: Pre-branch maintenance
3fc20632a3 qt: Set BLOCK_CHAIN_SIZE = 220 (DrahtBot)
2b6a2f4a28 Regenerate manpages (DrahtBot)
eb7daf4d60 Update copyright headers to 2018 (DrahtBot)

Pull request description:

  Some trivial maintenance to avoid having to do it again after the 0.17 branch off.

  (The scripts to do this are in `./contrib/`)

Tree-SHA512: 16b2af45e0351b1c691c5311d48025dc6828079e98c2aa2e600dc5910ee8aa01858ca6c356538150dc46fe14c8819ed8ec8e4ec9a0f682b9950dd41bc50518fa
2018-08-08 13:55:27 +02:00
MarcoFalke fa587773e5
scripted-diff: Remove unused first argument to addUnchecked
-BEGIN VERIFY SCRIPT-
git grep -l addUnchecked | xargs sed --regexp-extended -i -e 's/addUnchecked\([^)][^,]+,\s*/addUnchecked(/g'
-END VERIFY SCRIPT-
2018-07-30 09:09:32 -04:00
MarcoFalke ddd395f968 Mark CTxMemPoolEntry members that should not be modified const 2018-07-30 08:57:49 -04:00
MarcoFalke fa5ed4f8d2
refactor: Avoid locking tx pool cs thrice 2018-07-29 08:04:06 -04:00
practicalswift d78a8dc3e8 Return void instead of bool for functions that cannot fail
* CBlockTreeDB::ReadReindexing(...)
* CChainState::ResetBlockFailureFlags(...)
* CTxMemPool::addUnchecked(...)
* CWallet::LoadDestData(...)
* CWallet::LoadKeyMetadata(...)
* CWallet::LoadScriptMetadata(...)
* CWallet::LoadToWallet(...)
* CWallet::SetHDChain(...)
* CWallet::SetHDSeed(...)
* RemoveLocal(...)
* SetMinVersion(...)
* StartHTTPServer(...)
* StartRPC(...)
* TorControlConnection::Disconnect(...)
2018-07-27 13:19:03 +02:00
DrahtBot eb7daf4d60 Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
João Barbosa 12dd101345 scripted-diff: Remove trailing whitespaces
-BEGIN VERIFY SCRIPT-

sed --in-place'' --regexp-extended 's/[[:space:]]+$//g' $(git grep -I --files-with-matches --extended-regexp '[[:space:]]+$' -- src test  ':!*.svg' ':!src/crypto/sha256_sse4*' ':!src/leveldb' ':!src/qt/locale' ':!src/secp256k1' ':!src/univalue')

-END VERIFY SCRIPT-
2018-07-24 20:46:23 +01:00
practicalswift 01a06d6686 Avoid locking mutexes that are already held by the same thread 2018-07-21 19:46:04 +02:00
MarcoFalke faca0a8625
doc: Clarify that mempool txiter is const_iterator 2018-06-24 15:49:09 -04:00
Karl-Johan Alm 322b12ac4e
Remove deprecated TransactionWithinChainLimit 2018-06-11 19:04:56 +09:00
Karl-Johan Alm 475a385a80
Add GetTransactionAncestry to CTxMemPool for general purpose chain limit checking 2018-06-11 19:04:55 +09:00
Karl-Johan Alm 46847d69d2
mempool: Fix max descendants check
The chain limits check for max descendants would check the descendants of the transaction itself even though the description for -limitdescendantcount says 'any ancestor'. This commit corrects the descendant count check by finding the top parent transaction in the mempool and comparing against that.
2018-06-11 19:04:55 +09:00
Karl-Johan Alm b9ef21dd72
mempool: Add explicit max_descendants
TransactionWithinChainLimits would take a 'limit' and check it against ascendants and descendants. This is changed to take an explicit
max ancestors and max descendants value, and to test the corresponding value against its corresponding max.
2018-06-11 19:04:55 +09:00
jc 643ce1226c [validation] add Joinsplit related and zk specific checks 2018-06-04 07:22:35 -04:00
practicalswift 47782b49e6 Add Clang thread safety analysis annotations 2018-05-05 16:51:22 +02:00
practicalswift 0e2dfa8a65 Fix missing locking in CTxMemPool::setSanityCheck(double dFrequency)
* writing variable 'nCheckFrequency' requires holding mutex 'cs'
2018-05-05 16:50:58 +02:00
practicalswift cbba1d2da4 Add compile time checking for all ::mempool.cs runtime locking assertions 2018-05-05 08:11:05 +02:00
Wladimir J. van der Laan 18815b4bfb
Merge #11742: rpc: Add testmempoolaccept
b55555d rpc: Add testmempoolaccept (MarcoFalke)

Pull request description:

  To check if a single raw transaction makes it into the current transaction pool, one had to call `sendrawtransaction`. However, on success, this adds the transaction to the mempool with no easy way to undo.

  The call `testmempoolaccept` is introduced to provide a way to solely check the result without changing the mempool state.

Tree-SHA512: 5afd9311190135cee8fc1f229c7d39bf893f1028f29e28d34f70df820198ff97b4bf86b41cbbd6e6c36a5c30073cefa92d541c74a4939c7a2a6fa283dfd41b63
2018-04-02 16:02:33 +02:00
Roman Zeyde 1fdc7c41bb
Make CTxMemPool::isSpent() const 2018-03-25 11:32:41 +03:00
MarcoFalke b55555da3e
rpc: Add testmempoolaccept 2018-03-24 11:17:08 -04:00
Dimitris Apostolou 4d9b4256d8 Fix typos 2018-03-21 08:34:44 +02:00
Suhas Daftuar 669c9433cf Avoid leaking prioritization information when relaying transactions 2018-01-25 18:02:24 -05:00
Suhas Daftuar 09754063e0 Correct mempool mapTx comment 2018-01-19 09:58:21 -05:00
Wladimir J. van der Laan 44080a90a2
Merge #12118: Sort mempool by min(feerate, ancestor_feerate)
0a22a52 Use mempool's ancestor sort in transaction selection (Suhas Daftuar)
7abfa53 Add test for new ancestor feerate sort behavior (Suhas Daftuar)
9a51319 Sort mempool by min(feerate, ancestor_feerate) (Suhas Daftuar)
6773f92 Refactor CompareTxMemPoolEntryByDescendantScore (Suhas Daftuar)

Pull request description:

  This more closely approximates the desirability of a given transaction for
  mining, and should result in less re-sorting when transactions get removed from
  the mempool after being mined.

  I measured this as approximately a 5% speedup in removeForBlock.

Tree-SHA512: ffa36b567c5dfe3e8908c545a459b6a5ec0de26e7dc81b1050dd235cac9046564b4409a3f8c5ba97bd8b30526e8fec8f78480a912e317979467f32305c3dd37b
2018-01-15 15:36:35 +01:00
Suhas Daftuar 0a22a52918 Use mempool's ancestor sort in transaction selection
Transaction selection for mining tracks ancestor feerates that are
modified based on transactions that have already been selected.  This
commit de-duplicates the code so that the ancestor feerate sorting used
by the mempool can also be directly applied to the miner.
2018-01-13 15:57:30 -05:00
Suhas Daftuar 9a51319578 Sort mempool by min(feerate, ancestor_feerate)
This more closely approximates the desirability of a given transaction for
mining.
2018-01-09 12:27:57 -05:00
Suhas Daftuar 6773f92b30 Refactor CompareTxMemPoolEntryByDescendantScore 2018-01-09 11:53:40 -05:00
Suhas Daftuar 8e617e3708 Remove unused mempool index 2018-01-09 08:59:21 -05:00
Akira Takizawa 595a7bab23 Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
Suhas Daftuar 1ec0c0a01c Make boost::multi_index comparators const
This fixes compatibility with boost 1.66
2017-12-07 10:06:38 -05:00
MeshCollider 1a445343f6 scripted-diff: Replace #include "" with #include <> (ryanofsky)
-BEGIN VERIFY SCRIPT-
for f in \
  src/*.cpp \
  src/*.h \
  src/bench/*.cpp \
  src/bench/*.h \
  src/compat/*.cpp \
  src/compat/*.h \
  src/consensus/*.cpp \
  src/consensus/*.h \
  src/crypto/*.cpp \
  src/crypto/*.h \
  src/crypto/ctaes/*.h \
  src/policy/*.cpp \
  src/policy/*.h \
  src/primitives/*.cpp \
  src/primitives/*.h \
  src/qt/*.cpp \
  src/qt/*.h \
  src/qt/test/*.cpp \
  src/qt/test/*.h \
  src/rpc/*.cpp \
  src/rpc/*.h \
  src/script/*.cpp \
  src/script/*.h \
  src/support/*.cpp \
  src/support/*.h \
  src/support/allocators/*.h \
  src/test/*.cpp \
  src/test/*.h \
  src/wallet/*.cpp \
  src/wallet/*.h \
  src/wallet/test/*.cpp \
  src/wallet/test/*.h \
  src/zmq/*.cpp \
  src/zmq/*.h
do
  base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f
done
-END VERIFY SCRIPT-
2017-11-16 08:23:01 +13:00
Wladimir J. van der Laan 927a1d7d08
Merge #10286: Call wallet notify callbacks in scheduler thread (without cs_main)
89f0312 Remove redundant pwallet nullptr check (Matt Corallo)
c4784b5 Add a dev notes document describing the new wallet RPC blocking (Matt Corallo)
3ea8b75 Give ZMQ consistent order with UpdatedBlockTip on scheduler thread (Matt Corallo)
cb06edf Fix wallet RPC race by waiting for callbacks in sendrawtransaction (Matt Corallo)
e545ded Also call other wallet notify callbacks in scheduler thread (Matt Corallo)
17220d6 Use callbacks to cache whether wallet transactions are in mempool (Matt Corallo)
5d67a78 Add calls to CWallet::BlockUntilSyncedToCurrentChain() in RPCs (Matt Corallo)
5ee3172 Add CWallet::BlockUntilSyncedToCurrentChain() (Matt Corallo)
0b2f42d Add CallFunctionInQueue to wait on validation interface queue drain (Matt Corallo)
2b4b345 Add ability to assert a lock is not held in DEBUG_LOCKORDER (Matt Corallo)
0343676 Call TransactionRemovedFromMempool in the CScheduler thread (Matt Corallo)
a7d3936 Add a CValidationInterface::TransactionRemovedFromMempool (Matt Corallo)

Pull request description:

  Based on #10179, this effectively reverts #9583, regaining most of the original speedups of #7946.

  This concludes the work of #9725, #10178, and #10179.

  See individual commit messages for more information.

Tree-SHA512: eead4809b0a75d1fb33b0765174ff52c972e45040635e38cf3686cef310859c1e6b3c00e7186cbd17374c6ae547bfbd6c1718fe36f26c76ba8a8b052d6ed7bc9
2017-11-15 16:25:40 +01:00
MarcoFalke 61fb80660f
Merge #11269: [Mempool] CTxMemPoolEntry::UpdateAncestorState: modifySiagOps param type
203a4aa31 Fix CTxMemPoolEntry::UpdateAncestorState: modifySigOps param type int -> int64_t (donaloconnor)

Pull request description:

  CTxMemPoolEntry::CTxMemPoolEntry's modifySigOps parameter is int while update_ancestor_state::modifySigOpsCost is int64_t. This issue was raised in #11165. It looks like the function paramaters were not changed in commit 72abd2c

  This will avoid unexpected truncation of int64_t -> int

Tree-SHA512: 314c703f217e104336456859066d18fb0d12c4f9f32835e17490a6f29eb05951184095039e4e57edacef8ad35dd75c6d97d9af656a52209dd0c3779b4ffa0914
2017-11-10 15:33:30 -05:00
Matt Corallo a7d3936de8 Add a CValidationInterface::TransactionRemovedFromMempool
This is currently unused, but will by used by wallet to cache when
transactions are in the mempool, obviating the need for calls to
mempool from CWalletTx::InMempool()
2017-10-13 19:29:54 -04:00
Matt Corallo 53a6590f49 Make float <-> int casts explicit outside of test, qt, CFeeRate 2017-09-11 15:51:37 -04:00
donaloconnor 203a4aa31e Fix CTxMemPoolEntry::UpdateAncestorState: modifySigOps param type int -> int64_t 2017-09-07 19:13:01 +01:00
Wladimir J. van der Laan 38a54a50fa
Merge #11164: Fix boost headers included as user instead of system headers
5ac072caa Fix boost headers included as user instead of system headers (Dan Raviv)

Pull request description:

  In most of the project, boost headers are included as system headers.
  Fix the few inconsistent places where they aren't.

Tree-SHA512: 280af33a7bdc9d68a15b729fa88e1e7627e20a054b8d52a12cc5350c1ac9e9c90fb09f0aa97a00960969f75bcf3403dc52b834c94448b814efa63bfaf3b82663
2017-09-05 22:27:17 +02:00
Dan Raviv b426e24678 Remove redundant explicitly defined copy ctors
CFeeRate and CTxMemPoolEntry have explicitly defined copy ctors which has the same functionality as the implicit default copy ctors which would have been generated otherwise.

Besides being redundant, it violates the rule of three (see https://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming) ).
(Of course, the rule of three doesn't -really- cause a resource management issue here, but the reason for that is exactly that there is no need for an explicit copy ctor in the first place since no resources are being managed).
CFeeRate has an explicitly defined copy ctor which has the same functionality as the implicit default copy ctor which would h
ave been generated otherwise.
2017-08-28 01:29:48 +03:00
Dan Raviv 5ac072caa2 Fix boost headers included as user instead of system headers
In most of the project, boost headers are included as system headers.
Fix the few inconsistent places where they aren't.
2017-08-26 21:09:00 +03:00
practicalswift 64fb0ac016 Declare single-argument (non-converting) constructors "explicit"
In order to avoid unintended implicit conversions.
2017-08-16 16:33:25 +02:00
MarcoFalke b6a48914c5
Merge #9964: Add const to methods that do not modify the object for which it is called
6e8c48dc5 Add const to methods that do not modify the object for which it is called (practicalswift)

Pull request description:

Tree-SHA512: a6888111ba16fb796e320e60806e1a77d36f545989b5405dc7319992291800109eab0b8e8c286b784778f41f1ff5289e7cb6b4afd7aec77f385fbcafc02cffc1
2017-08-16 02:09:49 +02:00
practicalswift 90d4d89230 scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL
-BEGIN VERIFY SCRIPT-
sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h
sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp
sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp
sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp
sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp
sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp
-END VERIFY SCRIPT-
2017-08-07 07:36:37 +02:00
practicalswift 6e8c48dc59 Add const to methods that do not modify the object for which it is called 2017-07-25 13:46:52 +02:00
Pieter Wuille 30c21306c1
Merge #10685: Clarify CCoinsViewMemPool documentation.
381b8fc36 Clarify CCoinsViewMemPool documentation. (Matt Corallo)

Tree-SHA512: 0d1520595a03ea4038b4119871d79dfc28a50f42ac7667b30a583805d4fe4b0480a6912b9b4f7660c7223778ef85f2f9d1870551383a35c5e8c88cd2935f59d3
2017-06-28 11:22:00 -07:00
Matt Corallo 381b8fc365 Clarify CCoinsViewMemPool documentation.
Thanks to @sdaftuar for correcting my misunderstanding.
2017-06-27 14:47:07 -04:00