Skip to content

Commit

Permalink
Rename preconfirm to validate.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed May 21, 2024
1 parent dbfbba4 commit 677d56a
Show file tree
Hide file tree
Showing 20 changed files with 83 additions and 83 deletions.
6 changes: 3 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ src_libbitcoin_node_la_SOURCES = \
src/chasers/chaser_check.cpp \
src/chasers/chaser_confirm.cpp \
src/chasers/chaser_header.cpp \
src/chasers/chaser_preconfirm.cpp \
src/chasers/chaser_snapshot.cpp \
src/chasers/chaser_storage.cpp \
src/chasers/chaser_template.cpp \
src/chasers/chaser_transaction.cpp \
src/chasers/chaser_validate.cpp \
src/protocols/protocol.cpp \
src/protocols/protocol_block_in.cpp \
src/protocols/protocol_block_in_31800.cpp \
Expand Down Expand Up @@ -89,9 +89,9 @@ test_libbitcoin_node_test_SOURCES = \
test/chasers/chaser_check.cpp \
test/chasers/chaser_confirm.cpp \
test/chasers/chaser_header.cpp \
test/chasers/chaser_preconfirm.cpp \
test/chasers/chaser_template.cpp \
test/chasers/chaser_transaction.cpp \
test/chasers/chaser_validate.cpp \
test/protocols/protocol.cpp \
test/sessions/session.cpp

Expand Down Expand Up @@ -140,11 +140,11 @@ include_bitcoin_node_chasers_HEADERS = \
include/bitcoin/node/chasers/chaser_confirm.hpp \
include/bitcoin/node/chasers/chaser_header.hpp \
include/bitcoin/node/chasers/chaser_organize.hpp \
include/bitcoin/node/chasers/chaser_preconfirm.hpp \
include/bitcoin/node/chasers/chaser_snapshot.hpp \
include/bitcoin/node/chasers/chaser_storage.hpp \
include/bitcoin/node/chasers/chaser_template.hpp \
include/bitcoin/node/chasers/chaser_transaction.hpp \
include/bitcoin/node/chasers/chaser_validate.hpp \
include/bitcoin/node/chasers/chasers.hpp

include_bitcoin_node_impl_chasersdir = ${includedir}/bitcoin/node/impl/chasers
Expand Down
4 changes: 2 additions & 2 deletions builds/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ add_library( ${CANONICAL_LIB_NAME}
"../../src/chasers/chaser_check.cpp"
"../../src/chasers/chaser_confirm.cpp"
"../../src/chasers/chaser_header.cpp"
"../../src/chasers/chaser_preconfirm.cpp"
"../../src/chasers/chaser_snapshot.cpp"
"../../src/chasers/chaser_storage.cpp"
"../../src/chasers/chaser_template.cpp"
"../../src/chasers/chaser_transaction.cpp"
"../../src/chasers/chaser_validate.cpp"
"../../src/protocols/protocol.cpp"
"../../src/protocols/protocol_block_in.cpp"
"../../src/protocols/protocol_block_in_31800.cpp"
Expand Down Expand Up @@ -329,9 +329,9 @@ if (with-tests)
"../../test/chasers/chaser_check.cpp"
"../../test/chasers/chaser_confirm.cpp"
"../../test/chasers/chaser_header.cpp"
"../../test/chasers/chaser_preconfirm.cpp"
"../../test/chasers/chaser_template.cpp"
"../../test/chasers/chaser_transaction.cpp"
"../../test/chasers/chaser_validate.cpp"
"../../test/protocols/protocol.cpp"
"../../test/sessions/session.cpp" )

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
<ClCompile Include="..\..\..\..\test\chasers\chaser_check.cpp" />
<ClCompile Include="..\..\..\..\test\chasers\chaser_confirm.cpp" />
<ClCompile Include="..\..\..\..\test\chasers\chaser_header.cpp" />
<ClCompile Include="..\..\..\..\test\chasers\chaser_preconfirm.cpp" />
<ClCompile Include="..\..\..\..\test\chasers\chaser_template.cpp" />
<ClCompile Include="..\..\..\..\test\chasers\chaser_transaction.cpp" />
<ClCompile Include="..\..\..\..\test\chasers\chaser_validate.cpp" />
<ClCompile Include="..\..\..\..\test\configuration.cpp" />
<ClCompile Include="..\..\..\..\test\error.cpp" />
<ClCompile Include="..\..\..\..\test\main.cpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
<ClCompile Include="..\..\..\..\test\chasers\chaser_header.cpp">
<Filter>src\chasers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\chasers\chaser_preconfirm.cpp">
<Filter>src\chasers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\chasers\chaser_template.cpp">
<Filter>src\chasers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\chasers\chaser_transaction.cpp">
<Filter>src\chasers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\chasers\chaser_validate.cpp">
<Filter>src\chasers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\configuration.cpp">
<Filter>src</Filter>
</ClCompile>
Expand Down
4 changes: 2 additions & 2 deletions builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@
<ClCompile Include="..\..\..\..\src\chasers\chaser_check.cpp" />
<ClCompile Include="..\..\..\..\src\chasers\chaser_confirm.cpp" />
<ClCompile Include="..\..\..\..\src\chasers\chaser_header.cpp" />
<ClCompile Include="..\..\..\..\src\chasers\chaser_preconfirm.cpp" />
<ClCompile Include="..\..\..\..\src\chasers\chaser_snapshot.cpp" />
<ClCompile Include="..\..\..\..\src\chasers\chaser_storage.cpp" />
<ClCompile Include="..\..\..\..\src\chasers\chaser_template.cpp" />
<ClCompile Include="..\..\..\..\src\chasers\chaser_transaction.cpp" />
<ClCompile Include="..\..\..\..\src\chasers\chaser_validate.cpp" />
<ClCompile Include="..\..\..\..\src\configuration.cpp" />
<ClCompile Include="..\..\..\..\src\error.cpp" />
<ClCompile Include="..\..\..\..\src\full_node.cpp" />
Expand Down Expand Up @@ -114,11 +114,11 @@
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_confirm.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_header.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_organize.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_preconfirm.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_snapshot.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_storage.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_template.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_transaction.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_validate.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chasers.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\configuration.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\define.hpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@
<ClCompile Include="..\..\..\..\src\chasers\chaser_header.cpp">
<Filter>src\chasers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\chasers\chaser_preconfirm.cpp">
<Filter>src\chasers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\chasers\chaser_snapshot.cpp">
<Filter>src\chasers</Filter>
</ClCompile>
Expand All @@ -78,6 +75,9 @@
<ClCompile Include="..\..\..\..\src\chasers\chaser_transaction.cpp">
<Filter>src\chasers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\chasers\chaser_validate.cpp">
<Filter>src\chasers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\configuration.cpp">
<Filter>src</Filter>
</ClCompile>
Expand Down Expand Up @@ -167,9 +167,6 @@
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_organize.hpp">
<Filter>include\bitcoin\node\chasers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_preconfirm.hpp">
<Filter>include\bitcoin\node\chasers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_snapshot.hpp">
<Filter>include\bitcoin\node\chasers</Filter>
</ClInclude>
Expand All @@ -182,6 +179,9 @@
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_transaction.hpp">
<Filter>include\bitcoin\node\chasers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chaser_validate.hpp">
<Filter>include\bitcoin\node\chasers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\node\chasers\chasers.hpp">
<Filter>include\bitcoin\node\chasers</Filter>
</ClInclude>
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
#include <bitcoin/node/chasers/chaser_confirm.hpp>
#include <bitcoin/node/chasers/chaser_header.hpp>
#include <bitcoin/node/chasers/chaser_organize.hpp>
#include <bitcoin/node/chasers/chaser_preconfirm.hpp>
#include <bitcoin/node/chasers/chaser_snapshot.hpp>
#include <bitcoin/node/chasers/chaser_storage.hpp>
#include <bitcoin/node/chasers/chaser_template.hpp>
#include <bitcoin/node/chasers/chaser_transaction.hpp>
#include <bitcoin/node/chasers/chaser_validate.hpp>
#include <bitcoin/node/chasers/chasers.hpp>
#include <bitcoin/node/protocols/protocol.hpp>
#include <bitcoin/node/protocols/protocol_block_in.hpp>
Expand Down
22 changes: 11 additions & 11 deletions include/bitcoin/node/chase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ enum class chase
/// -----------------------------------------------------------------------

/// Chasers directed to start operating (height_t).
/// Issued by 'full_node' and handled by 'preconfirm'.
/// Issued by 'full_node' and handled by 'validate'.
start,

/// Disk space is limited (count_t).
/// Issued by full_node and handled by 'snapshot' and 'storage'.
space,

/// Chaser is directed to start when there are no downloads (height_t).
/// Issued by 'organize' and handled by 'preconfirm'.
/// Issued by 'organize' and handled by 'validate'.
bump,

/// Channels (all) directed to stop (channel_t).
Expand Down Expand Up @@ -87,12 +87,12 @@ enum class chase
/// Late-stage Invalidity.
/// -----------------------------------------------------------------------

/// unchecked, unpreconfirmable or unconfirmable was handled (height_t).
/// Issued by 'organize' and handled by 'preconfirm' (disorgs candidates).
/// unchecked, unvalid or unconfirmable was handled (height_t).
/// Issued by 'organize' and handled by 'validate' (disorgs candidates).
disorganized,

/// stored block was determined to be malleated (invalid) (header_t).
/// Issued by 'preconfirm' and 'confirm', handled by 'chaser' (redownload).
/// Issued by 'validate' and 'confirm', handled by 'chaser' (redownload).
malleated,

/// Validation.
Expand All @@ -106,13 +106,13 @@ enum class chase
/// Issued by 'block_in_31800' and handled by 'header'.
unchecked,

/// A branch has become preconfirmable (height_t).
/// Issued by 'preconfirm' and handled by 'confirm'.
preconfirmable,
/// A branch has become valid (height_t).
/// Issued by 'validate' and handled by 'confirm'.
valid,

/// A checked block has failed preconfirmability (header_t).
/// Issued by 'preconfirm' and handled by 'header'.
unpreconfirmable,
/// A checked block has failed validation (header_t).
/// Issued by 'validate' and handled by 'header'.
unvalid,

/// Confirmation.
/// -----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/chasers/chaser_confirm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class BCN_API chaser_confirm
virtual bool handle_event(const code& ec, chase event_,
event_value value) NOEXCEPT;

virtual void do_preconfirmed(height_t height) NOEXCEPT;
virtual void do_validated(height_t height) NOEXCEPT;
virtual code confirm(const database::header_link& link,
size_t height) NOEXCEPT;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBBITCOIN_NODE_CHASERS_CHASER_PRECONFIRM_HPP
#define LIBBITCOIN_NODE_CHASERS_CHASER_PRECONFIRM_HPP
#ifndef LIBBITCOIN_NODE_CHASERS_CHASER_VALIDATE_HPP
#define LIBBITCOIN_NODE_CHASERS_CHASER_VALIDATE_HPP

#include <bitcoin/database.hpp>
#include <bitcoin/node/chasers/chaser.hpp>
Expand All @@ -29,13 +29,13 @@ namespace node {
class full_node;

/// Chase down blocks in the the candidate header chain for validation.
class BCN_API chaser_preconfirm
class BCN_API chaser_validate
: public chaser
{
public:
DELETE_COPY_MOVE_DESTRUCT(chaser_preconfirm);
DELETE_COPY_MOVE_DESTRUCT(chaser_validate);

chaser_preconfirm(full_node& node) NOEXCEPT;
chaser_validate(full_node& node) NOEXCEPT;

code start() NOEXCEPT override;

Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/chasers/chasers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <bitcoin/node/chasers/chaser_confirm.hpp>
#include <bitcoin/node/chasers/chaser_header.hpp>
#include <bitcoin/node/chasers/chaser_organize.hpp>
#include <bitcoin/node/chasers/chaser_preconfirm.hpp>
#include <bitcoin/node/chasers/chaser_validate.hpp>
#include <bitcoin/node/chasers/chaser_snapshot.hpp>
#include <bitcoin/node/chasers/chaser_storage.hpp>
#include <bitcoin/node/chasers/chaser_template.hpp>
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ enum error_t : uint8_t
set_confirmed,
block_confirmable,
set_txs_connected,
set_block_preconfirmable,
set_block_valid,

/// query composite
node_push,
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/full_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class BCN_API full_node
chaser_block chaser_block_;
chaser_header chaser_header_;
chaser_check chaser_check_;
chaser_preconfirm chaser_preconfirm_;
chaser_validate chaser_validate_;
chaser_confirm chaser_confirm_;
chaser_transaction chaser_transaction_;
chaser_template chaser_template_;
Expand Down
14 changes: 7 additions & 7 deletions include/bitcoin/node/impl/chasers/chaser_organize.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ bool CLASS::handle_event(const code&, chase event_, event_value value) NOEXCEPT
switch (event_)
{
case chase::unchecked:
case chase::unpreconfirmable:
case chase::unvalid:
case chase::unconfirmable:
{
POST(do_disorganize, possible_narrow_cast<header_t>(value));
Expand Down Expand Up @@ -172,10 +172,10 @@ void CLASS::do_organize(typename Block::cptr& block_ptr,
// This eventually stops the peer, but the full set of headers may
// still cycle through to become strong, despite this being stored
// as block_unconfirmable from a block validate or confirm failure.
// Block preconfirmation will then fail and this cycle will
// continue until a strong candidate chain is located. The cycle
// occurs because peers continue to send the same headers,which
// may indicate an local failure or peer failures.
// Block validation will then fail and this cycle will continue
// until a strong candidate chain is located. The cycle occurs
// because peers continue to send the same headers, which may
// indicate a local failure or peer failures.
handler(ec, height);
return;
}
Expand Down Expand Up @@ -341,10 +341,10 @@ void CLASS::do_organize(typename Block::cptr& block_ptr,
// is already downloaded, then new header will arrive and download will
// be skipped, resulting in stall until restart at which time the start
// event will advance through all downloaded candidates and progress on
// arrivals. This bumps preconfirmation for current strong headers.
// arrivals. This bumps validation for current strong headers.
notify(error::success, chase::bump, add1(branch_point));

// Start block downloads, which upon completion bumps preconfirmation.
// Start block downloads, which upon completion bumps validation.
notify(error::success, chase_object(), branch_point);
}

Expand Down
12 changes: 6 additions & 6 deletions src/chasers/chaser_confirm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ bool chaser_confirm::handle_event(const code&, chase event_,
{
case chase::block:
{
POST(do_preconfirmed, possible_narrow_cast<height_t>(value));
POST(do_validated, possible_narrow_cast<height_t>(value));
break;
}
case chase::preconfirmable:
case chase::valid:
{
POST(do_preconfirmed, possible_narrow_cast<height_t>(value));
POST(do_validated, possible_narrow_cast<height_t>(value));
break;
}
case chase::stop:
Expand All @@ -84,7 +84,7 @@ bool chaser_confirm::handle_event(const code&, chase event_,
return true;
}

// Blocks are either confirmed (blocks first) or preconfirmed/confirmed
// Blocks are either confirmed (blocks first) or validated/confirmed
// (headers first) at this point. An unconfirmable block may not land here.
// Candidate chain reorganizations will result in reported heights moving
// in any direction. Each is treated as independent and only one representing
Expand All @@ -94,7 +94,7 @@ bool chaser_confirm::handle_event(const code&, chase event_,
// The scans are extremely fast and tiny in all typical scnearios, so it may
// not improve performance or be worth spending 32 bytes per header to store
// work, especially since individual header work is obtained from 4 bytes.
void chaser_confirm::do_preconfirmed(height_t height) NOEXCEPT
void chaser_confirm::do_validated(height_t height) NOEXCEPT
{
BC_ASSERT(stranded());

Expand Down Expand Up @@ -271,7 +271,7 @@ code chaser_confirm::confirm(const header_link& link, size_t height) NOEXCEPT
ec == database::error::block_unconfirmable)
return ec;

if (ec == database::error::block_preconfirmable)
if (ec == database::error::block_valid)
return error::success;

// Should not get here without a known block state.
Expand Down
Loading

0 comments on commit 677d56a

Please sign in to comment.