Skip to content

Commit

Permalink
[doc] fix docs and comments from v3
Browse files Browse the repository at this point in the history
  • Loading branch information
glozow committed Feb 12, 2024
1 parent e3c1711 commit 63b62e1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion doc/policy/mempool-replacements.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ other consensus and policy rules, each of the following conditions are met:

1. The directly conflicting transactions all signal replaceability explicitly. A transaction is
signaling BIP125 replaceability if any of its inputs have an nSequence number less than (0xffffffff - 1).
A transaction also signals replaceibility if its nVersion field is set to 3.
A transaction also signals replaceability if its nVersion field is set to 3.

*Rationale*: See [BIP125
explanation](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki#motivation).
Expand Down
5 changes: 2 additions & 3 deletions src/policy/v3_policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,16 @@ std::optional<std::string> PackageV3Checks(const CTransactionRef& ptx, int64_t v
vsize, V3_CHILD_MAX_VSIZE);
}

// Exactly 1 parent exists, either in mempool or package. Find it.
const auto parent_info = [&] {
if (mempool_ancestors.size() > 0) {
// There's a parent in the mempool.
auto& mempool_parent = *mempool_ancestors.begin();
Assume(mempool_parent->GetCountWithDescendants() == 1);
return ParentInfo{mempool_parent->GetTx().GetHash(),
mempool_parent->GetTx().GetWitnessHash(),
mempool_parent->GetTx().nVersion,
/*has_mempool_descendant=*/mempool_parent->GetCountWithDescendants() > 1};
} else {
// Ancestor must be in the package. Find it.
auto& parent_index = in_package_parents.front();
auto& package_parent = package.at(parent_index);
return ParentInfo{package_parent->GetHash(),
Expand Down Expand Up @@ -184,7 +183,7 @@ std::optional<std::string> SingleV3Checks(const CTransactionRef& ptx,
// The rest of the rules only apply to transactions with nVersion=3.
if (ptx->nVersion != 3) return std::nullopt;

// Check that V3_ANCESTOR_LIMIT would not be violated, including both in-package and in-mempool.
// Check that V3_ANCESTOR_LIMIT would not be violated.
if (mempool_ancestors.size() + 1 > V3_ANCESTOR_LIMIT) {
return strprintf("tx %s (wtxid=%s) would have too many ancestors",
ptx->GetHash().ToString(), ptx->GetWitnessHash().ToString());
Expand Down
2 changes: 0 additions & 2 deletions src/test/fuzz/tx_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,6 @@ FUZZ_TARGET(tx_pool, .init = initialize_tx_pool)
const bool accepted = res.m_result_type == MempoolAcceptResult::ResultType::VALID;
if (accepted) {
txids.push_back(tx->GetHash());
// Only check fees if accepted and not bypass_limits, otherwise it's not guaranteed that
// trimming has happened for this tx and previous iterations.
CheckMempoolV3Invariants(tx_pool);
}
}
Expand Down

0 comments on commit 63b62e1

Please sign in to comment.