aboutsummaryrefslogtreecommitdiff
path: root/src/validationinterface.h
AgeCommit message (Collapse)Author
2018-03-14Polish interfaces around PeerLogicValidationVasil Dimov
* Make PeerLogicValidation final to prevent deriving from it [1] * Prevent deletions of NetEventsInterface and CValidationInterface objects via a base class pointer [1] silences the following compiler warning (from Clang 7.0.0): /usr/include/c++/v1/memory:2285:5: error: delete called on non-final 'PeerLogicValidation' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor] delete __ptr; ^ /usr/include/c++/v1/memory:2598:7: note: in instantiation of member function 'std::__1::default_delete<PeerLogicValidation>::operator()' requested here __ptr_.second()(__tmp); ^ init.cpp:201:15: note: in instantiation of member function 'std::__1::unique_ptr<PeerLogicValidation, std::__1::default_delete<PeerLogicValidation> >::reset' requested here peerLogic.reset(); ^
2018-01-03Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa
2017-12-26Add helper to wait for validation interface queue to catch upMatt Corallo
2017-12-26Add an interface to get the queue depth out of CValidationInterfaceMatt Corallo
2017-11-16scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider
-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-10-13Give ZMQ consistent order with UpdatedBlockTip on scheduler threadMatt Corallo
Note that UpdatedBlockTip is also used in net_processing to announce new blocks to peers. As this may need additional review, this change is included in its own commit.
2017-10-13Also call other wallet notify callbacks in scheduler threadMatt Corallo
This runs Block{Connected,Disconnected}, SetBestChain, Inventory, and TransactionAddedToMempool on the background scheduler thread. Of those, only BlockConnected is used outside of Wallet/ZMQ, and is used only for orphan transaction removal in net_processing, something which does not need to be synchronous with anything else. This partially reverts #9583, re-enabling some of the gains from #7946. This does not, however, re-enable the gains achieved by repeatedly releasing cs_main between each transaction processed.
2017-10-13Add CallFunctionInQueue to wait on validation interface queue drainMatt Corallo
2017-10-13Call TransactionRemovedFromMempool in the CScheduler threadMatt Corallo
This is both good practice (we want to move all such callbacks into a background thread eventually) and prevents a lock inversion when we go to use this in wallet (mempool.cs->cs_wallet and cs_wallet->mempool.cs would otherwise both be used).
2017-10-13Add a CValidationInterface::TransactionRemovedFromMempoolMatt Corallo
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-07-15Remove declaration of unused function: void UpdatedTransaction(const uint256 &)practicalswift
2017-07-07Flush CValidationInterface callbacks prior to destructionMatt Corallo
Note that the CScheduler thread cant be running at this point, it has already been stopped with the rest of the init threadgroup. Thus, just calling any remaining loose callbacks during Shutdown() is sane.
2017-07-07Support more than one CScheduler thread for serial clientsMatt Corallo
This will be used by CValidationInterface soon. This requires a bit of work as we need to ensure that most of our callbacks happen in-order (to avoid synchronization issues in wallet) - we keep our own internal queue and push things onto it, scheduling a queue-draining function immediately upon new callbacks.
2017-07-07Give CMainSignals a reference to the global schedulerMatt Corallo
...so that it can run some signals in the background later
2017-07-03Make ValidationInterface signals-type-agnosticMatt Corallo
(by hiding boost::signals stuff in the .cpp) This allows us to give it a bit more intelligence as we move forward, including routing some signals through CScheduler. While the introduction of a "internals" pointer in the class is pretty ugly, the fact that we no longer need to include boost/signals directly from validationinterface.h is very much worth the loss.
2017-06-29rpc: Move the `generate` RPC call to rpcwalletWladimir J. van der Laan
This makes it possible to mine to any wallet when multi-wallet mode is added. Solves the same problem as #10649, but IMO in a cleaner way. It also gets rid of the circuitous `ScriptForMining` method on `CValidationInterface`, which really doesn't belong there. After this change it's still possible to mine without wallet through `generatetoaddress`.
2017-04-13Remove CValidationInterface::UpdatedTransactionMatt Corallo
This removes another callback from block connection logic, making it easier to reason about the wallet-RPCs-returns-stale-info issue. UpdatedTransaction was previously used by the GUI to display coinbase transactions only after they have a block built on top of them. This worked fine for in most cases, but only worked due to a corner case if the user received a coinbase payout in a block immediately prior to restart. In that case, the normal process of caching the most recent coinbase transaction's hash would not work, and instead it would only work because of the on-load -checkblocks calling DisconnectBlock and ConnectBlock on the current tip. In order to make this more robust, a full mapWallet loop after the first block which is connected after restart was added.
2017-04-07Use std::shared_ptr instead of boost::shared_ptr in ScriptForMiningMatt Corallo
2017-04-07Remove dead-code tracking of requests for blocks we generatedMatt Corallo
2017-04-07SyncTransaction->TxAddedToMempool/BlockConnected/DisconnectedMatt Corallo
This simplifies fixing the wallet-returns-stale-info issue as we can now hold cs_wallet across an entire block instead of only per-tx (though we only actually do so in the next commit). This change also removes the NOT_IN_BLOCK constant in favor of only passing the CBlockIndex* parameter to SyncTransactions when a new block is being connected, instead of also when a block is being disconnected. This change adds a parameter to BlockConnectedDisconnected which lists the transactions which were removed from mempool due to confliction as a result of this operation. While its somewhat of a shame to make block-validation-logic generate a list of mempool changes to be included in its generated callbacks, fixing this isnt too hard. Further in this change-set, CValidationInterface starts listening to mempool directly, placing it in the middle and giving it a bit of logic to know how to route notifications from block-validation, mempool, etc (though not listening for conflicted-removals yet).
2017-03-23Merge #9558: Clarify assumptions made about when BlockCheck is calledJonas Schnelli
c4a6929 Clarify assumptions made about when BlockCheck is called (Matt Corallo) Tree-SHA512: 2eceb0c4f06c7fd6b290b93843bda11a4b63131559c5e8226bfec84596ed4e54ee6d8f5bc9cf789a80675be8b8079cf9234c96032df306258cb2260b9d8c7825
2017-02-14[trivial] Fix recently introduced typos in commentspracticalswift
2017-01-23Better document usage of SyncTransactionAlex Morcos
2017-01-14Clarify assumptions made about when BlockCheck is calledMatt Corallo
2017-01-05Add a CValidationInterface::NewPoWValidBlock callbackMatt Corallo
2016-12-31Increment MIT Licence copyright header year on files modified in 2016isle2983
Edited via: $ contrib/devtools/copyright_header.py update .
2016-10-04Remove SyncWithWallets wrapper functionMatt Corallo
2016-10-04Make validationinterface.UpdatedBlockTip more verboseMatt Corallo
In anticipation of making all the callbacks out of block processing flow through it. Note that vHashes will always have something in it since pindexFork != pindexNewTip.
2016-09-08net: Pass CConnection to wallet rather than using the globalCory Fields
2016-08-12Reduce cs_main locks during ConnectTip/SyncWithWalletsJonas Schnelli
2016-02-04Merge #6480: include the chaintip blockindex in the SyncTransaction signal, ↵Wladimir J. van der Laan
add signal UpdateTip() 7d0bf0b include the chaintip *blockIndex in the SyncTransaction signal (Jonas Schnelli)
2015-12-13Bump copyright headers to 2015MarcoFalke
2015-12-04include the chaintip *blockIndex in the SyncTransaction signalJonas Schnelli
- allows reducing of calls to main.cpp for getting the chaintip during transaction syncing - potentially allows reducing of cs_main locks
2015-09-16use CBlockIndex* insted of uint256 for UpdatedBlockTip signalJonas Schnelli
- removes mapBlockIndex find operation - theoretically allows removing the cs_main lock during zqm notification while introducing a new file position lock
2015-09-16Add UpdatedBlockTip signal to CMainSignals and CValidationInterfaceJoão Barbosa
2015-07-01miner: rename UpdateRequestCount signal to ResetRequestCountJonas Schnelli
2015-07-01add CReserveScript to allow modular script keeping/returningJonas Schnelli
- use one CReserveScript per mining thread
2015-06-30detach wallet from minerJonas Schnelli
2015-05-18Remove unused code from wallet and validation interfaceMichael Ford
Fixes #6109
2015-05-14fix IDE/compiler warning "extra ';'" in validationinterface.hPhilip Kaufmann
2015-03-30Merge pull request #5940Wladimir J. van der Laan
0f5954c Regression test for ResendWalletTransactions (Gavin Andresen)
2015-03-29Fix clang compile warnings intriduced in #5681Michael Ford
2015-03-24Regression test for ResendWalletTransactionsGavin Andresen
Adds a regression test for the wallet's ResendWalletTransactions function, which uses a new, hidden RPC command "resendwallettransactions." I refactored main's Broadcast signal so it is passed the best-block time, which let me remove a global variable shared between main.cpp and the wallet (nTimeBestReceived). I also manually tested the "rebroadcast unconfirmed every half hour or so" functionality by: 1. Running bitcoind -connect=0.0.0.0:8333 2. Creating a couple of send-to-self transactions 3. Connect to a peer using -addnode 4. Waited a while, monitoring debug.log, until I see: ```2015-03-23 18:48:10 ResendWalletTransactions: rebroadcast 2 unconfirmed transactions``` One last change: don't bother putting ResendWalletTransactions messages in debug.log unless unconfirmed transactions were actually rebroadcast.
2015-03-24Includes: Refactor: Move CValidationInterface and CMainSignals out of mainJorge Timón