aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/chain.h
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-07-26 10:23:01 -0400
committerRussell Yanofsky <russ@yanofsky.org>2018-11-06 11:44:40 -0400
commit79d579f4e11b57f90fed314bccd25230f918729f (patch)
tree1886caa0cd9fdf2aaaa84ad7160472d87e0eb68c /src/interfaces/chain.h
parentea961c3d7256c66146b4976ab1293db4a628c0de (diff)
downloadbitcoin-79d579f4e11b57f90fed314bccd25230f918729f.tar.xz
Remove uses of cs_main in wallet code
This commit does not change behavior. It is easiest to review this change with: git log -p -n1 -U0
Diffstat (limited to 'src/interfaces/chain.h')
-rw-r--r--src/interfaces/chain.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h
index 30bc9f5f73..fe5658de4b 100644
--- a/src/interfaces/chain.h
+++ b/src/interfaces/chain.h
@@ -18,6 +18,26 @@ class Chain
{
public:
virtual ~Chain() {}
+
+ //! Interface for querying locked chain state, used by legacy code that
+ //! assumes state won't change between calls. New code should avoid using
+ //! the Lock interface and instead call higher-level Chain methods
+ //! that return more information so the chain doesn't need to stay locked
+ //! between calls.
+ class Lock
+ {
+ public:
+ virtual ~Lock() {}
+ };
+
+ //! Return Lock interface. Chain is locked when this is called, and
+ //! unlocked when the returned interface is freed.
+ virtual std::unique_ptr<Lock> lock(bool try_lock = false) = 0;
+
+ //! Return Lock interface assuming chain is already locked. This
+ //! method is temporary and is only used in a few places to avoid changing
+ //! behavior while code is transitioned to use the Chain::Lock interface.
+ virtual std::unique_ptr<Lock> assumeLocked() = 0;
};
//! Interface to let node manage chain clients (wallets, or maybe tools for