diff options
Diffstat (limited to 'src/validationinterface.h')
-rw-r--r-- | src/validationinterface.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/validationinterface.h b/src/validationinterface.h index 42cc2e9a20..f0374e8e78 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2017 The Bitcoin Core developers +// Copyright (c) 2009-2018 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -7,10 +7,12 @@ #define BITCOIN_VALIDATIONINTERFACE_H #include <primitives/transaction.h> // CTransaction(Ref) +#include <sync.h> #include <functional> #include <memory> +extern CCriticalSection cs_main; class CBlock; class CBlockIndex; struct CBlockLocator; @@ -51,8 +53,23 @@ void CallFunctionInValidationInterfaceQueue(std::function<void ()> func); * }); * promise.get_future().wait(); */ -void SyncWithValidationInterfaceQueue(); +void SyncWithValidationInterfaceQueue() LOCKS_EXCLUDED(cs_main); +/** + * Implement this to subscribe to events generated in validation + * + * Each CValidationInterface() subscriber will receive event callbacks + * in the order in which the events were generated by validation. + * Furthermore, each ValidationInterface() subscriber may assume that + * callbacks effectively run in a single thread with single-threaded + * memory consistency. That is, for a given ValidationInterface() + * instantiation, each callback will complete before the next one is + * invoked. This means, for example when a block is connected that the + * UpdatedBlockTip() callback may depend on an operation performed in + * the BlockConnected() callback without worrying about explicit + * synchronization. No ordering should be assumed across + * ValidationInterface() subscribers. + */ class CValidationInterface { protected: /** |