Skip to content

Commit b16a280

Browse files
authored
Merge pull request #111 from wcatz/fix/tickn-eta-ph-epoch-offset
fix(nonce): correct TICKN η_ph epoch offset by one
2 parents fad0b2f + a43602b commit b16a280

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nonce.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,10 @@ func (nt *NonceTracker) GetNonceForEpoch(epoch int) ([]byte, error) {
420420
// At 60% of epoch N, we need epoch N+1's nonce (not yet on Koios).
421421
// epochNonce(N+1) = BLAKE2b-256(η_c(N) || η_ph)
422422
// where η_ph = praosStateLastEpochBlockNonce = prevHash of the last block
423-
// of epoch N-1 = hash of the second-to-last block of epoch N-1.
423+
// of epoch N = hash of the second-to-last block of epoch N.
424424
if nt.fullMode {
425425
candidateEpoch := epoch - 1
426-
etaPhEpoch := candidateEpoch - 1
426+
etaPhEpoch := candidateEpoch // η_ph comes from the same epoch as the candidate
427427
log.Printf("TICKN: attempting to compute epoch %d nonce from candidate(%d) + η_ph(%d)",
428428
epoch, candidateEpoch, etaPhEpoch)
429429
candidate, candErr := nt.store.GetCandidateNonce(ctx, candidateEpoch)

0 commit comments

Comments
 (0)