aboutsummaryrefslogtreecommitdiff
path: root/src/policy/v3_policy.h
diff options
context:
space:
mode:
authorAva Chow <github@achow101.com>2024-07-02 17:49:32 -0400
committerAva Chow <github@achow101.com>2024-07-02 17:49:32 -0400
commit3325a0afa45ee88c9e859f1002183f1bd61868da (patch)
tree9fd7c07e064f118ce45b476fb399629d23f83757 /src/policy/v3_policy.h
parent9251bc71110412ff248ee99fbb215d84b60c8c7c (diff)
parent926b8e39dcbc0a3a8a75ef0a29bdca2bf738d746 (diff)
Merge bitcoin/bitcoin#30272: doc: use TRUC instead of v3 and add release note
926b8e39dcbc0a3a8a75ef0a29bdca2bf738d746 [doc] add release note for TRUC (glozow) 19a9b90617419f68d0f1c90ee115b5220be99a16 use version=3 instead of v3 in debug strings (glozow) 881fac8e609be17eb71bd9a54c0284b304e2e2e2 scripted-diff: change names from V3 to TRUC (glozow) a573dd261748d2a80560f73db08f7dca788c7fcf [doc] replace mentions of v3 with TRUC (glozow) 089b5757dff39a9a06cdb625aaced9beeb72958d rename mempool_accept_v3.py to mempool_truc.py (glozow) f543852a89d93441645250c40c3980aeb0c3b664 rename policy/v3_policy.* to policy/truc_policy.* (glozow) Pull request description: Adds a release note for TRUC policy which will be live in v28.0. For clarity, replaces mentions of "v3" with "TRUC" in most places. Suggested in - https://github.com/bitcoin/bitcoin/pull/29496#discussion_r1629749583 - https://github.com/bitcoin/bitcoin/pull/29496#discussion_r1624500904 I changed error strings from "v3-violation" to "TRUC-violation" but left v3 in the debug strings because I think it might be clearer for somebody who is debugging. Similarly, I left some variables unchanged because I think they're more descriptive this way, e.g. `tx_v3_from_v2_and_v3`. I'm happy to debate places that should or shouldn't be documented differently in this PR, whatever is clearest to everyone. ACKs for top commit: instagibbs: reACK https://github.com/bitcoin/bitcoin/pull/30272/commits/926b8e39dcbc0a3a8a75ef0a29bdca2bf738d746 achow101: ACK 926b8e39dcbc0a3a8a75ef0a29bdca2bf738d746 ismaelsadeeq: Code review ACK 926b8e39dcbc0a3a8a75ef0a29bdca2bf738d746 Tree-SHA512: 16c88add0a29dc6d1236c4d45f34a17b850f6727b231953cbd52eb9f7268d1d802563eadfc8b7928c94ed3d7a615275dd103e57e81439ebf3ba2b12efa1e42af
Diffstat (limited to 'src/policy/v3_policy.h')
-rw-r--r--src/policy/v3_policy.h93
1 files changed, 0 insertions, 93 deletions
diff --git a/src/policy/v3_policy.h b/src/policy/v3_policy.h
deleted file mode 100644
index 90eaeda46f..0000000000
--- a/src/policy/v3_policy.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2022 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#ifndef BITCOIN_POLICY_V3_POLICY_H
-#define BITCOIN_POLICY_V3_POLICY_H
-
-#include <consensus/amount.h>
-#include <policy/packages.h>
-#include <policy/policy.h>
-#include <primitives/transaction.h>
-#include <txmempool.h>
-#include <util/result.h>
-
-#include <set>
-#include <string>
-
-// This module enforces rules for BIP 431 TRUC transactions (with version=3) which help make
-// RBF abilities more robust.
-static constexpr decltype(CTransaction::version) TRUC_VERSION{3};
-
-// v3 only allows 1 parent and 1 child when unconfirmed.
-/** Maximum number of transactions including an unconfirmed tx and its descendants. */
-static constexpr unsigned int V3_DESCENDANT_LIMIT{2};
-/** Maximum number of transactions including a V3 tx and all its mempool ancestors. */
-static constexpr unsigned int V3_ANCESTOR_LIMIT{2};
-
-/** Maximum sigop-adjusted virtual size of all v3 transactions. */
-static constexpr int64_t V3_MAX_VSIZE{10000};
-/** Maximum sigop-adjusted virtual size of a tx which spends from an unconfirmed v3 transaction. */
-static constexpr int64_t V3_CHILD_MAX_VSIZE{1000};
-// These limits are within the default ancestor/descendant limits.
-static_assert(V3_MAX_VSIZE + V3_CHILD_MAX_VSIZE <= DEFAULT_ANCESTOR_SIZE_LIMIT_KVB * 1000);
-static_assert(V3_MAX_VSIZE + V3_CHILD_MAX_VSIZE <= DEFAULT_DESCENDANT_SIZE_LIMIT_KVB * 1000);
-
-/** Must be called for every transaction, even if not v3. Not strictly necessary for transactions
- * accepted through AcceptMultipleTransactions.
- *
- * Checks the following rules:
- * 1. A v3 tx must only have v3 unconfirmed ancestors.
- * 2. A non-v3 tx must only have non-v3 unconfirmed ancestors.
- * 3. A v3's ancestor set, including itself, must be within V3_ANCESTOR_LIMIT.
- * 4. A v3's descendant set, including itself, must be within V3_DESCENDANT_LIMIT.
- * 5. If a v3 tx has any unconfirmed ancestors, the tx's sigop-adjusted vsize must be within
- * V3_CHILD_MAX_VSIZE.
- * 6. A v3 tx must be within V3_MAX_VSIZE.
- *
- *
- * @param[in] mempool_ancestors The in-mempool ancestors of ptx.
- * @param[in] direct_conflicts In-mempool transactions this tx conflicts with. These conflicts
- * are used to more accurately calculate the resulting descendant
- * count of in-mempool ancestors.
- * @param[in] vsize The sigop-adjusted virtual size of ptx.
- *
- * @returns 3 possibilities:
- * - std::nullopt if all v3 checks were applied successfully
- * - debug string + pointer to a mempool sibling if this transaction would be the second child in a
- * 1-parent-1-child cluster; the caller may consider evicting the specified sibling or return an
- * error with the debug string.
- * - debug string + nullptr if this transaction violates some v3 rule and sibling eviction is not
- * applicable.
- */
-std::optional<std::pair<std::string, CTransactionRef>> SingleV3Checks(const CTransactionRef& ptx,
- const CTxMemPool::setEntries& mempool_ancestors,
- const std::set<Txid>& direct_conflicts,
- int64_t vsize);
-
-/** Must be called for every transaction that is submitted within a package, even if not v3.
- *
- * For each transaction in a package:
- * If it's not a v3 transaction, verify it has no direct v3 parents in the mempool or the package.
-
- * If it is a v3 transaction, verify that any direct parents in the mempool or the package are v3.
- * If such a parent exists, verify that parent has no other children in the package or the mempool,
- * and that the transaction itself has no children in the package.
- *
- * If any v3 violations in the package exist, this test will fail for one of them:
- * - if a v3 transaction T has a parent in the mempool and a child in the package, then PV3C(T) will fail
- * - if a v3 transaction T has a parent in the package and a child in the package, then PV3C(T) will fail
- * - if a v3 transaction T and a v3 (sibling) transaction U have some parent in the mempool,
- * then PV3C(T) and PV3C(U) will fail
- * - if a v3 transaction T and a v3 (sibling) transaction U have some parent in the package,
- * then PV3C(T) and PV3C(U) will fail
- * - if a v3 transaction T has a parent P and a grandparent G in the package, then
- * PV3C(P) will fail (though PV3C(G) and PV3C(T) might succeed).
- *
- * @returns debug string if an error occurs, std::nullopt otherwise.
- * */
-std::optional<std::string> PackageV3Checks(const CTransactionRef& ptx, int64_t vsize,
- const Package& package,
- const CTxMemPool::setEntries& mempool_ancestors);
-
-#endif // BITCOIN_POLICY_V3_POLICY_H