Skip to content
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ BITCOIN_CORE_H = \
util/sock.h \
util/string.h \
util/spanparsing.h \
util/subprocess.hpp \
util/subprocess.h \
util/syserror.h \
util/system.h \
util/time.h \
Expand Down
2 changes: 1 addition & 1 deletion src/common/run_command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <univalue.h>

#ifdef ENABLE_EXTERNAL_SIGNER
#include <util/subprocess.hpp>
#include <util/subprocess.h>
#endif // ENABLE_EXTERNAL_SIGNER

UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in)
Expand Down
4 changes: 2 additions & 2 deletions src/test/fuzz/poolresource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class PoolResourceFuzzer
{
if (m_total_allocated > 0x1000000) return;
size_t alignment_bits = m_provider.ConsumeIntegralInRange<size_t>(0, 7);
size_t alignment = 1 << alignment_bits;
size_t alignment = size_t{1} << alignment_bits;
size_t size_bits = m_provider.ConsumeIntegralInRange<size_t>(0, 16 - alignment_bits);
size_t size = m_provider.ConsumeIntegralInRange<size_t>(1U << size_bits, (1U << (size_bits + 1)) - 1U) << alignment_bits;
size_t size = m_provider.ConsumeIntegralInRange<size_t>(size_t{1} << size_bits, (size_t{1} << (size_bits + 1)) - 1U) << alignment_bits;
Allocate(size, alignment);
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/system_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <univalue.h>

#ifdef ENABLE_EXTERNAL_SIGNER
#include <util/subprocess.hpp>
#include <util/subprocess.h>
#endif // ENABLE_EXTERNAL_SIGNER

#include <boost/test/unit_test.hpp>
Expand Down
7 changes: 4 additions & 3 deletions src/test/validation_chainstate_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <test/util/random.h>
#include <test/util/setup_common.h>
#include <uint256.h>
#include <util/check.h>
#include <validation.h>

#include <vector>
Expand Down Expand Up @@ -96,14 +97,14 @@ BOOST_FIXTURE_TEST_CASE(chainstate_update_tip, TestChain100Setup)

BOOST_CHECK_EQUAL(chainman.GetAll().size(), 2);

CChainState& background_cs{*[&] {
CChainState& background_cs{*Assert([&]() -> CChainState* {
for (CChainState* cs : chainman.GetAll()) {
if (cs != &chainman.ActiveChainstate()) {
return cs;
}
}
assert(false);
}()};
return nullptr;
}())};

// Create a block to append to the validation chain.
std::vector<CMutableTransaction> noTxns;
Expand Down
17 changes: 9 additions & 8 deletions src/txorphanage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
#include <logging.h>
#include <policy/policy.h>
#include <stats/client.h>
#include <util/time.h>

#include <cassert>

/** Expiration time for orphan transactions in seconds */
static constexpr int64_t ORPHAN_TX_EXPIRE_TIME = 20 * 60;
/** Minimum time between orphan transactions expire time checks in seconds */
static constexpr int64_t ORPHAN_TX_EXPIRE_INTERVAL = 5 * 60;
/** Expiration time for orphan transactions */
static constexpr auto ORPHAN_TX_EXPIRE_TIME{20min};
/** Minimum time between orphan transactions expire time checks */
static constexpr auto ORPHAN_TX_EXPIRE_INTERVAL{5min};


bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer)
Expand All @@ -39,7 +40,7 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer)
return false;
}

auto ret = m_orphans.emplace(hash, OrphanTx{tx, peer, GetTime() + ORPHAN_TX_EXPIRE_TIME, m_orphan_list.size(), sz});
auto ret = m_orphans.emplace(hash, OrphanTx{tx, peer, Now<NodeSeconds>() + ORPHAN_TX_EXPIRE_TIME, m_orphan_list.size(), sz});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking: Missing prerequisites for bitcoin#30170: bitcoin#28364, bitcoin#29031, bitcoin#30000

New cumulative finding. Upstream bitcoin#30170 was applied on a newer TxOrphanage baseline: its pre-PR state indexed m_orphans by Wtxid, erased by Wtxid, had a TXPACKAGES elapsed-time removal log, and used LimitOrphans(unsigned int max_orphans, FastRandomContext& rng). Those upstream baseline pieces trace to bitcoin#28364, bitcoin#29031, and bitcoin#30000. Dash current head adapts the time-type conversion onto the older txid-keyed orphanage with internal RNG creation and no elapsed-time TXPACKAGES removal log. The adaptation appears clean for the narrow NodeSeconds conversion, so this is not blocking, but under the origin-based prerequisite rule the upstream dependency chain for the claimed bitcoin#30170 backport is incomplete.


Policy gate (backport-prereq-restore): For full upstream backport PRs, a missing prerequisite is blocking unless the finding is explicitly allowlisted (e.g. intentional_exclusion: true or a matching entry in policy_overrides). The agent's original evidence above is the basis for this block; either backport the prerequisite or annotate the intentional exclusion in the PR description.

source: ['codex-backport-reviewer']

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in this update — Missing prerequisites for bitcoin#30170: bitcoin#28364, bitcoin#29031, bitcoin#30000 no longer present.

Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread.

assert(ret.second);
m_orphan_list.push_back(ret.first);
for (const CTxIn& txin : tx->vin) {
Expand Down Expand Up @@ -121,12 +122,12 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans_size)
LOCK(m_mutex);

unsigned int nEvicted = 0;
static int64_t nNextSweep;
int64_t nNow = GetTime();
static NodeSeconds nNextSweep;
auto nNow{Now<NodeSeconds>()};
if (nNextSweep <= nNow) {
// Sweep out expired orphan pool entries:
int nErased = 0;
int64_t nMinExpTime = nNow + ORPHAN_TX_EXPIRE_TIME - ORPHAN_TX_EXPIRE_INTERVAL;
auto nMinExpTime = nNow + ORPHAN_TX_EXPIRE_TIME - ORPHAN_TX_EXPIRE_INTERVAL;
std::map<uint256, OrphanTx>::iterator iter = m_orphans.begin();
while (iter != m_orphans.end())
{
Expand Down
3 changes: 2 additions & 1 deletion src/txorphanage.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <sync.h>
#include <util/time.h>

#include <map>
#include <set>
Expand Down Expand Up @@ -70,7 +71,7 @@ class TxOrphanage {
struct OrphanTx {
CTransactionRef tx;
NodeId fromPeer;
int64_t nTimeExpire;
NodeSeconds nTimeExpire;
size_t list_pos;
size_t nTxSize;
};
Expand Down
Loading
Loading