@@ -519,14 +519,14 @@ class CoinsViews {
519
519
public:
520
520
// ! The lowest level of the CoinsViews cache hierarchy sits in a leveldb database on disk.
521
521
// ! All unspent coins reside in this store.
522
- CCoinsViewDB m_dbview;
522
+ CCoinsViewDB m_dbview GUARDED_BY (cs_main) ;
523
523
524
524
// ! This view wraps access to the leveldb instance and handles read errors gracefully.
525
- CCoinsViewErrorCatcher m_catcherview;
525
+ CCoinsViewErrorCatcher m_catcherview GUARDED_BY (cs_main) ;
526
526
527
527
// ! This is the top layer of the cache hierarchy - it keeps as many coins in memory as
528
528
// ! can fit per the dbcache setting.
529
- std::unique_ptr<CCoinsViewCache> m_cacheview;
529
+ std::unique_ptr<CCoinsViewCache> m_cacheview GUARDED_BY (cs_main) ;
530
530
531
531
// ! This constructor initializes CCoinsViewDB and CCoinsViewErrorCatcher instances, but it
532
532
// ! *does not* create a CCoinsViewCache instance by default. This is done separately because the
@@ -537,7 +537,7 @@ class CoinsViews {
537
537
CoinsViews (std::string ldb_name, size_t cache_size_bytes, bool in_memory, bool should_wipe);
538
538
539
539
// ! Initialize the CCoinsViewCache member.
540
- void InitCache ();
540
+ void InitCache () EXCLUSIVE_LOCKS_REQUIRED(::cs_main) ;
541
541
};
542
542
543
543
/* *
@@ -609,11 +609,11 @@ class CChainState {
609
609
610
610
// ! Initialize the in-memory coins cache (to be done after the health of the on-disk database
611
611
// ! is verified).
612
- void InitCoinsCache ();
612
+ void InitCoinsCache () EXCLUSIVE_LOCKS_REQUIRED(::cs_main) ;
613
613
614
614
// ! @returns whether or not the CoinsViews object has been fully initialized and we can
615
615
// ! safely flush this object to disk.
616
- bool CanFlushToDisk () {
616
+ bool CanFlushToDisk () EXCLUSIVE_LOCKS_REQUIRED(cs_main) {
617
617
return m_coins_views && m_coins_views->m_cacheview ;
618
618
}
619
619
@@ -629,21 +629,21 @@ class CChainState {
629
629
std::set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexCandidates;
630
630
631
631
// ! @returns A reference to the in-memory cache of the UTXO set.
632
- CCoinsViewCache& CoinsTip ()
632
+ CCoinsViewCache& CoinsTip () EXCLUSIVE_LOCKS_REQUIRED(cs_main)
633
633
{
634
634
assert (m_coins_views->m_cacheview );
635
635
return *m_coins_views->m_cacheview .get ();
636
636
}
637
637
638
638
// ! @returns A reference to the on-disk UTXO set database.
639
- CCoinsViewDB& CoinsDB ()
639
+ CCoinsViewDB& CoinsDB () EXCLUSIVE_LOCKS_REQUIRED(cs_main)
640
640
{
641
641
return m_coins_views->m_dbview ;
642
642
}
643
643
644
644
// ! @returns A reference to a wrapped view of the in-memory UTXO set that
645
645
// ! handles disk read errors gracefully.
646
- CCoinsViewErrorCatcher& CoinsErrorCatcher ()
646
+ CCoinsViewErrorCatcher& CoinsErrorCatcher () EXCLUSIVE_LOCKS_REQUIRED(cs_main)
647
647
{
648
648
return m_coins_views->m_catcherview ;
649
649
}
0 commit comments