Skip to content

Commit f9d2ab3

Browse files
skeeesfurszy
authored andcommitted
Update ValidationInterface() documentation to explicitly specify threading and memory model
1 parent cb9bb25 commit f9d2ab3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/validationinterface.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,21 @@ void CallFunctionInValidationInterfaceQueue(std::function<void ()> func);
5454
*/
5555
void SyncWithValidationInterfaceQueue();
5656

57+
/**
58+
* Implement this to subscribe to events generated in validation
59+
*
60+
* Each CValidationInterface() subscriber will receive event callbacks
61+
* in the order in which the events were generated by validation.
62+
* Furthermore, each ValidationInterface() subscriber may assume that
63+
* callbacks effectively run in a single thread with single-threaded
64+
* memory consistency. That is, for a given ValidationInterface()
65+
* instantiation, each callback will complete before the next one is
66+
* invoked. This means, for example when a block is connected that the
67+
* UpdatedBlockTip() callback may depend on an operation performed in
68+
* the BlockConnected() callback without worrying about explicit
69+
* synchronization. No ordering should be assumed across
70+
* ValidationInterface() subscribers.
71+
*/
5772
class CValidationInterface {
5873
public:
5974
virtual ~CValidationInterface() = default;

0 commit comments

Comments
 (0)