Skip to content

dash-spv: a header batch that fails validation is dropped and sync reports Synced at the stale tip #1194

Open

Description

@xdustinface

HeadersPipeline::take_ready_to_store drains a segment's buffered headers before they are validated. When store_ready_batches / store_headers then rejects the batch (BlockHeaderValidator, or the "Segment chain break" check), sync_manager only logs the error and emits SyncEvent::ManagerError. After that:

  • The rejected headers are gone, but the segment still counts as complete.
  • Every later segment fails with "Segment chain break".
  • Once all segments are drained, is_complete() is true, so finalize_sync_if_complete sets SyncState::Synced at the stale tip.
  • The peer that served the batch is not penalised, and nothing is re-requested.
  • A restart replays the same failure.

Reproduction. Run a real mainnet sync with #1161 and --start-height 750000. Checkpoint 750000 carries the wrong time and bits, so block 750024 is rejected. The client logs Headers sync complete at height 750000 and reports Synced 750000/2557756 while peers are at 2557756. With --start-height 0 it ends at Synced 32000/... the same way. #1161 only supplies the rejection. The pipeline and the error handling are unchanged from dev, so a batch that fails continuity or PoW on dev ends the same way.

Expected:

  • A rejected batch is re-requested from another peer, and the peer that served it is penalised.
  • Header sync never reports Synced below the best height its peers report.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions