Skip to content

Commit 6dfab7d

Browse files
authored
fix: use dynamic era name in UtxoFailure error message (#1225)
Replace hardcoded 'Alonzo' with dynamic era name lookup using the era ID stored in the UtxoFailure struct. This makes the error message format consistent across all eras. Closes #846 Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 9650d4d commit 6dfab7d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ledger/error.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,9 @@ func (e *UtxoFailure) UnmarshalCBOR(data []byte) error {
299299
}
300300

301301
func (e *UtxoFailure) Error() string {
302-
// TODO: lookup era name programmatically (#846)
303-
return fmt.Sprintf("UtxoFailure (FromAlonzoUtxoFail (%s))", e.Err)
302+
// Dynamically determine era name using the era ID from the struct
303+
eraName := GetEraById(e.Era).Name
304+
return fmt.Sprintf("UtxoFailure (From%sUtxoFail (%s))", eraName, e.Err)
304305
}
305306

306307
type UtxoFailureErrorBase struct {

0 commit comments

Comments
 (0)