aboutsummaryrefslogtreecommitdiff
path: root/src/policy/rbf.h
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2021-07-27 15:55:25 +0100
committerglozow <gloriajzhao@gmail.com>2021-09-02 16:23:27 +0100
commit3f033f01a6b0f7772ae1b21044903b8f4249ad08 (patch)
tree9827288b5d98a2d0aa8423ac14f5d835f0969b2e /src/policy/rbf.h
parent7b60c02b7d5e2ab12288393d2258873ebb26d811 (diff)
downloadbitcoin-3f033f01a6b0f7772ae1b21044903b8f4249ad08.tar.xz
MOVEONLY: check for disjoint conflicts and ancestors to policy/rbf
This checks that a transaction isn't trying to replace something it supposedly depends on.
Diffstat (limited to 'src/policy/rbf.h')
-rw-r--r--src/policy/rbf.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/policy/rbf.h b/src/policy/rbf.h
index 0f9a3d9856..6c4e218959 100644
--- a/src/policy/rbf.h
+++ b/src/policy/rbf.h
@@ -56,4 +56,17 @@ std::optional<std::string> GetEntriesForConflicts(const CTransaction& tx, CTxMem
std::optional<std::string> HasNoNewUnconfirmed(const CTransaction& tx, const CTxMemPool& m_pool,
const CTxMemPool::setEntries& setIterConflicting)
EXCLUSIVE_LOCKS_REQUIRED(m_pool.cs);
+
+/** Check the intersection between two sets of transactions (a set of mempool entries and a set of
+ * txids) to make sure they are disjoint.
+ * @param[in] setAncestors Set of mempool entries corresponding to ancestors of the
+ * replacement transactions.
+ * @param[in] setConflicts Set of txids corresponding to the mempool conflicts
+ * (candidates to be replaced).
+ * @param[in] txid Transaction ID, included in the error message if violation occurs.
+ * @returns error message if the sets intersect, std::nullopt if they are disjoint.
+ */
+std::optional<std::string> EntriesAndTxidsDisjoint(const CTxMemPool::setEntries& setAncestors,
+ const std::set<uint256>& setConflicts,
+ const uint256& txid);
#endif // BITCOIN_POLICY_RBF_H