aboutsummaryrefslogtreecommitdiff
path: root/src/txorphanage.h
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2021-03-31 18:34:49 +0100
committerJohn Newbery <john@johnnewbery.com>2021-07-20 13:12:42 +0100
commit9190b01d8dcf03b74e9b9e1653688a97ac171b37 (patch)
treed42ceee268c5a577ad21fc432c7c8ae5dd306de3 /src/txorphanage.h
parent201c5e4aec5210b258644ff96379cda0ca7273ab (diff)
downloadbitcoin-9190b01d8dcf03b74e9b9e1653688a97ac171b37.tar.xz
[net processing] Add Orphanage empty consistency check
When removing the final peer, assert that m_tx_orphanage is empty.
Diffstat (limited to 'src/txorphanage.h')
-rw-r--r--src/txorphanage.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/txorphanage.h b/src/txorphanage.h
index e4266e470a..24c8318f36 100644
--- a/src/txorphanage.h
+++ b/src/txorphanage.h
@@ -47,6 +47,13 @@ public:
* (ie orphans that may have found their final missing parent, and so should be reconsidered for the mempool) */
void AddChildrenToWorkSet(const CTransaction& tx, std::set<uint256>& orphan_work_set) const EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
+ /** Return how many entries exist in the orphange */
+ size_t Size() LOCKS_EXCLUDED(::g_cs_orphans)
+ {
+ LOCK(::g_cs_orphans);
+ return m_orphans.size();
+ }
+
protected:
struct OrphanTx {
CTransactionRef tx;