Bitcoin ABC  0.26.3
P2P Digital Currency
Classes | Functions | Variables
validationinterface.h File Reference
#include <primitives/transaction.h>
#include <sync.h>
#include <functional>
#include <memory>
Include dependency graph for validationinterface.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CValidationInterface
 Implement this to subscribe to events generated in validation. More...
 
class  CMainSignals
 

Functions

void RegisterValidationInterface (CValidationInterface *callbacks)
 Register subscriber. More...
 
void UnregisterValidationInterface (CValidationInterface *callbacks)
 Unregister subscriber. More...
 
void UnregisterAllValidationInterfaces ()
 Unregister all subscribers. More...
 
void RegisterSharedValidationInterface (std::shared_ptr< CValidationInterface > callbacks)
 Register subscriber. More...
 
void UnregisterSharedValidationInterface (std::shared_ptr< CValidationInterface > callbacks)
 Unregister subscriber. More...
 
void CallFunctionInValidationInterfaceQueue (std::function< void()> func)
 Pushes a function to callback onto the notification queue, guaranteeing any callbacks generated prior to now are finished when the function is called. More...
 
void SyncWithValidationInterfaceQueue () LOCKS_EXCLUDED(cs_main)
 This is a synonym for the following, which asserts certain locks are not held: std::promise<void> promise; CallFunctionInValidationInterfaceQueue([&promise] { promise.set_value(); }); promise.get_future().wait();. More...
 
CMainSignalsGetMainSignals ()
 

Variables

RecursiveMutex cs_main
 Global state. More...
 

Function Documentation

◆ CallFunctionInValidationInterfaceQueue()

void CallFunctionInValidationInterfaceQueue ( std::function< void()>  func)

Pushes a function to callback onto the notification queue, guaranteeing any callbacks generated prior to now are finished when the function is called.

Be very careful blocking on func to be called if any locks are held - validation interface clients may not be able to make progress as they often wait for things like cs_main, so blocking until func is called with cs_main will result in a deadlock (that DEBUG_LOCKORDER will miss).

Definition at line 161 of file validationinterface.cpp.

Here is the caller graph for this function:

◆ GetMainSignals()

CMainSignals& GetMainSignals ( )

Definition at line 125 of file validationinterface.cpp.

Here is the caller graph for this function:

◆ RegisterSharedValidationInterface()

void RegisterSharedValidationInterface ( std::shared_ptr< CValidationInterface callbacks)

Register subscriber.

Definition at line 129 of file validationinterface.cpp.

Here is the caller graph for this function:

◆ RegisterValidationInterface()

void RegisterValidationInterface ( CValidationInterface callbacks)

Register subscriber.

Definition at line 136 of file validationinterface.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SyncWithValidationInterfaceQueue()

void SyncWithValidationInterfaceQueue ( )

This is a synonym for the following, which asserts certain locks are not held: std::promise<void> promise; CallFunctionInValidationInterfaceQueue([&promise] { promise.set_value(); }); promise.get_future().wait();.

Definition at line 165 of file validationinterface.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UnregisterAllValidationInterfaces()

void UnregisterAllValidationInterfaces ( )

Unregister all subscribers.

Definition at line 154 of file validationinterface.cpp.

Here is the caller graph for this function:

◆ UnregisterSharedValidationInterface()

void UnregisterSharedValidationInterface ( std::shared_ptr< CValidationInterface callbacks)

Unregister subscriber.

Definition at line 143 of file validationinterface.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UnregisterValidationInterface()

void UnregisterValidationInterface ( CValidationInterface callbacks)

Unregister subscriber.

DEPRECATED. This is not safe to use when the RPC server or main message handler thread is running.

Definition at line 148 of file validationinterface.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ cs_main

RecursiveMutex cs_main
extern

Global state.

Mutex to guard access to validation specific variables, such as reading or changing the chainstate.

This may also need to be locked when updating the transaction pool, e.g. on AcceptToMemoryPool. See CTxMemPool::cs comment for details.

The transaction pool has a separate lock to allow reading from it and the chainstate at the same time.

Definition at line 113 of file validation.cpp.