@@ -570,13 +570,14 @@ type StakeDistribution struct {
570570}
571571
572572// GetStakeDistribution returns the stake distribution for leader election.
573- // Uses the "go" snapshot which represents stake from 2 epochs ago.
573+ // Uses the "mark" snapshot at the given epoch. Callers pass currentEpoch-2
574+ // so the epoch offset already accounts for the Mark→Set→Go rotation.
574575func (lv * LedgerView ) GetStakeDistribution (
575576 epoch uint64 ,
576577) (* StakeDistribution , error ) {
577578 snapshots , err := lv .ls .db .Metadata ().GetPoolStakeSnapshotsByEpoch (
578579 epoch ,
579- "go " ,
580+ "mark " ,
580581 (* lv .txn ).Metadata (),
581582 )
582583 if err != nil {
@@ -598,15 +599,16 @@ func (lv *LedgerView) GetStakeDistribution(
598599 return dist , nil
599600}
600601
601- // GetPoolStake returns the stake for a specific pool from the "go" snapshot.
602- // Returns 0 if the pool has no stake in the snapshot.
602+ // GetPoolStake returns the stake for a specific pool from the snapshot.
603+ // Returns 0 if the pool has no stake in the snapshot. Callers pass
604+ // currentEpoch-2 so the epoch offset accounts for Mark→Set→Go rotation.
603605func (lv * LedgerView ) GetPoolStake (
604606 epoch uint64 ,
605607 poolKeyHash []byte ,
606608) (uint64 , error ) {
607609 snapshot , err := lv .ls .db .Metadata ().GetPoolStakeSnapshot (
608610 epoch ,
609- "go " ,
611+ "mark " ,
610612 poolKeyHash ,
611613 (* lv .txn ).Metadata (),
612614 )
@@ -619,11 +621,12 @@ func (lv *LedgerView) GetPoolStake(
619621 return uint64 (snapshot .TotalStake ), nil
620622}
621623
622- // GetTotalActiveStake returns the total active stake from the "go" snapshot.
624+ // GetTotalActiveStake returns the total active stake from the snapshot.
625+ // Callers pass currentEpoch-2 so the epoch offset accounts for rotation.
623626func (lv * LedgerView ) GetTotalActiveStake (epoch uint64 ) (uint64 , error ) {
624627 return lv .ls .db .Metadata ().GetTotalActiveStake (
625628 epoch ,
626- "go " ,
629+ "mark " ,
627630 (* lv .txn ).Metadata (),
628631 )
629632}
0 commit comments