From c9d4002e363c2ad5732a1d3e54e982f6cfa4afc0 Mon Sep 17 00:00:00 2001 From: Chris Gianelloni Date: Sun, 3 Aug 2025 11:25:10 -0400 Subject: [PATCH] fix(ledger): ensure hash and CBOR are set in initial block Signed-off-by: Chris Gianelloni --- ledger/state.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ledger/state.go b/ledger/state.go index 2edb3665..aba8fbc4 100644 --- a/ledger/state.go +++ b/ledger/state.go @@ -995,6 +995,11 @@ func (ls *LedgerState) forgeBlock() { // Get current chain tip currentTip := ls.chain.Tip() + // Set Hash if empty + if len(currentTip.Point.Hash) == 0 { + currentTip.Point.Hash = make([]byte, 28) + } + // Calculate next slot and block number nextSlot, err := ls.TimeToSlot(time.Now()) if err != nil { @@ -1175,6 +1180,9 @@ func (ls *LedgerState) forgeBlock() { return } + // Add block CBOR to itself for later decode + conwayBlock.SetCbor(blockCbor) + // Log the generated block CBOR (DEBUG level) ls.config.Logger.Debug( "forged empty conway block",