mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
Enforce that there is only one changeset at a time
This commit is contained in:
parent
7fb62f7db6
commit
18829194ca
1 changed files with 8 additions and 2 deletions
|
@ -811,7 +811,7 @@ public:
|
|||
class ChangeSet {
|
||||
public:
|
||||
explicit ChangeSet(CTxMemPool* pool) : m_pool(pool) {}
|
||||
~ChangeSet() = default;
|
||||
~ChangeSet() EXCLUSIVE_LOCKS_REQUIRED(m_pool->cs) { m_pool->m_have_changeset = false; }
|
||||
|
||||
ChangeSet(const ChangeSet&) = delete;
|
||||
ChangeSet& operator=(const ChangeSet&) = delete;
|
||||
|
@ -860,7 +860,13 @@ public:
|
|||
friend class CTxMemPool;
|
||||
};
|
||||
|
||||
std::unique_ptr<ChangeSet> GetChangeSet() EXCLUSIVE_LOCKS_REQUIRED(cs) { return std::make_unique<ChangeSet>(this); }
|
||||
std::unique_ptr<ChangeSet> GetChangeSet() EXCLUSIVE_LOCKS_REQUIRED(cs) {
|
||||
Assume(!m_have_changeset);
|
||||
m_have_changeset = true;
|
||||
return std::make_unique<ChangeSet>(this);
|
||||
}
|
||||
|
||||
bool m_have_changeset GUARDED_BY(cs){false};
|
||||
|
||||
friend class CTxMemPool::ChangeSet;
|
||||
|
||||
|
|
Loading…
Reference in a new issue