Skip to content

Commit c2b2e65

Browse files
committed
Remove set_strong/set_unstrong from organizer, style, comments.
1 parent 772a792 commit c2b2e65

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

include/bitcoin/node/impl/chasers/chaser_organize.ipp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -429,14 +429,8 @@ bool CLASS::set_reorganized(const database::header_link& link,
429429
height_t candidate_height) NOEXCEPT
430430
{
431431
BC_ASSERT(stranded());
432-
auto& query = archive();
433-
434-
// Any non-checkpoint block must be set unstrong.
435-
// But checkpointed blocks cannot be reorganized.
436432
BC_ASSERT(!is_under_checkpoint(candidate_height));
437-
438-
// TODO: make this atomic in store using two-phase commit.
439-
if (!query.set_unstrong(link) || !query.pop_candidate())
433+
if (!archive().pop_candidate())
440434
return false;
441435

442436
fire(events::header_reorganized, candidate_height);
@@ -449,13 +443,7 @@ bool CLASS::set_organized(const database::header_link& link,
449443
height_t candidate_height) NOEXCEPT
450444
{
451445
BC_ASSERT(stranded());
452-
auto& query = archive();
453-
454-
// Any non-checkpoint block must be set strong.
455-
const auto strong = is_block() && !is_under_checkpoint(candidate_height);
456-
457-
// TODO: make this atomic in store using two-phase commit.
458-
if ((strong && !query.set_strong(link)) || !query.push_candidate(link))
446+
if (!archive().push_candidate(link))
459447
return false;
460448

461449
fire(events::header_organized, candidate_height);

src/chasers/chaser_confirm.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -369,22 +369,17 @@ void chaser_confirm::complete_block(const code& ec, const header_link& link,
369369

370370
// Private setters
371371
// ----------------------------------------------------------------------------
372-
// These affect only confirmed chain and strong tx state (not candidate).
372+
// Checkpointed blocks are set strong by archiver, and cannot be reorganized.
373373

374-
// Milestoned blocks can become formerly-confirmed.
375-
// Checkpointed blocks cannot become formerly-confirmed.
376-
// Reorganization sets unstrong on any formerly-confirmed blocks.
377374
bool chaser_confirm::set_reorganized(const header_link& link,
378375
height_t confirmed_height) NOEXCEPT
379376
{
380377
BC_ASSERT(stranded());
381378
auto& query = archive();
382379

383-
// Any non-checkpoint block must be set unstrong.
384-
// But checkpointed blocks cannot be reorganized.
380+
// Checkpointed blocks cannot be reorganized.
385381
BC_ASSERT(!is_under_checkpoint(confirmed_height));
386382

387-
// TODO: make this atomic in store using two-phase commit.
388383
if (!query.set_unstrong(link) || !query.pop_confirmed())
389384
return false;
390385

@@ -394,18 +389,15 @@ bool chaser_confirm::set_reorganized(const header_link& link,
394389
return true;
395390
}
396391

397-
// Checkpointed blocks are set strong by archiver.
398-
// Organization sets strong/unstrong non-checkpointed blocks.
399392
bool chaser_confirm::set_organized(const header_link& link,
400393
height_t confirmed_height) NOEXCEPT
401394
{
402395
BC_ASSERT(stranded());
403396
auto& query = archive();
404397

405-
// Any non-checkpoint block must be set strong.
398+
// Checkpointed blocks are set strong by archiver (redundant here).
406399
const auto strong = !is_under_checkpoint(confirmed_height);
407400

408-
// TODO: make this atomic in store using two-phase commit.
409401
if ((strong && !query.set_strong(link)) || !query.push_confirmed(link))
410402
return false;
411403

@@ -416,7 +408,6 @@ bool chaser_confirm::set_organized(const header_link& link,
416408
}
417409

418410
// Rollback to the fork point, then forward through previously popped.
419-
// Rollback cannot apply to checkpointed blocks so always set strong/unstrong.
420411
bool chaser_confirm::roll_back(const header_links& popped, size_t fork_point,
421412
size_t top) NOEXCEPT
422413
{

0 commit comments

Comments
 (0)