mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
source.go carries Source, VM, Offer and Ballot — every type summary.go names. It was never tracked, so the published module did not compile at all for a consumer: undefined Source, undefined VM, undefined Ballot. The package's own tests passed the whole time, because a test builds against the working tree. Also corrects two of my own from the previous commit. A seed at or below the recovery hint stands again: the certified frontier belonging under what the VM has already applied is the safe direction, and the dangerous one — above — is what the walk-from-hint arm exists for. And the quorum-engine test harness now wires stake weighting, so a transport-authenticated vote is judged the way production judges it; without it the membership check refused every vote, including the validators' own. Co-authored-by: Hanzo Dev <[email protected]>
31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
// Copyright (C) 2019-2026, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package chain
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/luxfi/ids"
|
|
)
|
|
|
|
// The recovery hint is this node's own applied head — a local guess about what the
|
|
// network finalized, not authority over it. A cert at the hint's height seeds even
|
|
// when it names a different canonical, because the alternative is stranding a node
|
|
// whose head sits on a branch the network did not finalize.
|
|
func TestSeedStandsAtTheHintWithADifferentCanonical(t *testing.T) {
|
|
head, certified := ids.GenerateTestID(), ids.GenerateTestID()
|
|
led := FinalityLedger{}.withHint(head, 1_000_000)
|
|
|
|
next, plan, err := Finalize(led, Cert{Block: certified, Height: 1_000_000, Canonical: certified}, mapDAG{})
|
|
if err != nil {
|
|
t.Fatalf("a cert at the hint's own height must seed: %v", err)
|
|
}
|
|
if h, set := next.Height(); !set || h != 1_000_000 {
|
|
t.Fatalf("seeded height = %d set=%v, want 1000000 set", h, set)
|
|
}
|
|
if len(plan.Accept) != 1 || plan.Accept[0] != certified {
|
|
t.Fatalf("plan accepts %v, want exactly the certified block", plan.Accept)
|
|
}
|
|
}
|