@@ -1047,7 +1047,7 @@ bool transaction::is_invalid_coinbase_size() const NOEXCEPT
10471047// Accept (contextual).
10481048// ----------------------------------------------------------------------------
10491049
1050- bool transaction::is_non_final (size_t height, uint32_t timestamp,
1050+ bool transaction::is_absolute_locked (size_t height, uint32_t timestamp,
10511051 uint32_t median_time_past, bool bip113) const NOEXCEPT
10521052{
10531053 // BIP113: comparing the locktime against the median of the past 11 block
@@ -1153,7 +1153,7 @@ bool transaction::is_relative_locktime_applied(bool coinbase, uint32_t version,
11531153 (version >= relative_locktime_min_version);
11541154}
11551155
1156- bool transaction::is_internal_lock (const input& in) const NOEXCEPT
1156+ bool transaction::is_internally_locked (const input& in) const NOEXCEPT
11571157{
11581158 // BIP68: not applied to the sequence of the input of a coinbase.
11591159 BC_ASSERT (!is_coinbase ());
@@ -1162,10 +1162,12 @@ bool transaction::is_internal_lock(const input& in) const NOEXCEPT
11621162 if (version_ < relative_locktime_min_version)
11631163 return false ;
11641164
1165- return in.is_internal_lock ();
1165+ // Internal spends have no relative height/mtp (own metadata vs. itself).
1166+ return in.is_relative_locked (in.metadata .height ,
1167+ in.metadata .median_time_past );
11661168}
11671169
1168- bool transaction::is_locked (size_t height,
1170+ bool transaction::is_relative_locked (size_t height,
11691171 uint32_t median_time_past) const NOEXCEPT
11701172{
11711173 // BIP68: not applied to the sequence of the input of a coinbase.
@@ -1178,11 +1180,9 @@ bool transaction::is_locked(size_t height,
11781180 // BIP68: references to median time past are as defined by bip113.
11791181 const auto locked = [=](const auto & input) NOEXCEPT
11801182 {
1181- return input->is_locked (height, median_time_past);
1183+ return input->is_relative_locked (height, median_time_past);
11821184 };
11831185
1184- // BIP68: when the relative lock time is block based, it is interpreted as
1185- // a minimum block height constraint over the age of the input.
11861186 return std::any_of (inputs_->begin (), inputs_->end (), locked);
11871187}
11881188
@@ -1289,8 +1289,8 @@ code transaction::check(const context& ctx) const NOEXCEPT
12891289{
12901290 const auto bip113 = ctx.is_enabled (bip113_rule);
12911291
1292- if (is_non_final (ctx.height , ctx.timestamp , ctx.median_time_past , bip113))
1293- return error::transaction_non_final ;
1292+ if (is_absolute_locked (ctx.height , ctx.timestamp , ctx.median_time_past , bip113))
1293+ return error::absolute_time_locked ;
12941294
12951295 return error::transaction_success;
12961296}
@@ -1325,7 +1325,7 @@ code transaction::confirm(const context& ctx) const NOEXCEPT
13251325
13261326 if (is_coinbase ())
13271327 return error::transaction_success;
1328- if (bip68 && is_locked (ctx.height , ctx.median_time_past ))
1328+ if (bip68 && is_relative_locked (ctx.height , ctx.median_time_past ))
13291329 return error::relative_time_locked;
13301330 if (is_immature (ctx.height ))
13311331 return error::coinbase_maturity;
0 commit comments