From 44b4d99382ac7c210c7475c6930c1442b28b630d Mon Sep 17 00:00:00 2001 From: Aurora Gaffney Date: Tue, 8 Jul 2025 18:31:12 -0400 Subject: [PATCH] fix: Byron address CBOR encoding This makes Byron address bytes wrapped in a bytestring for CBOR, the same as Shelley addresses. It also switches the Byron genesis UTxO code to explicitly use address bytes rather than use the CBOR representation Fixes #1066 Signed-off-by: Aurora Gaffney --- ledger/byron/genesis.go | 5 ++--- ledger/common/address.go | 4 ---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/ledger/byron/genesis.go b/ledger/byron/genesis.go index 7c53539e..3c0e59d6 100644 --- a/ledger/byron/genesis.go +++ b/ledger/byron/genesis.go @@ -22,7 +22,6 @@ import ( "slices" "strconv" - "github.com/blinklabs-io/gouroboros/cbor" "github.com/blinklabs-io/gouroboros/ledger/common" ) @@ -123,7 +122,7 @@ func (g *ByronGenesis) avvmUtxos() ([]common.Utxo, error) { if err != nil { return nil, err } - addrBytes, err := cbor.Encode(tmpAddr) + addrBytes, err := tmpAddr.Bytes() if err != nil { return nil, err } @@ -155,7 +154,7 @@ func (g *ByronGenesis) nonAvvmUtxos() ([]common.Utxo, error) { if err != nil { return nil, err } - addrBytes, err := cbor.Encode(tmpAddr) + addrBytes, err := tmpAddr.Bytes() if err != nil { return nil, err } diff --git a/ledger/common/address.go b/ledger/common/address.go index 6d626f42..79b076c6 100644 --- a/ledger/common/address.go +++ b/ledger/common/address.go @@ -282,10 +282,6 @@ func (a *Address) MarshalCBOR() ([]byte, error) { if err != nil { return nil, fmt.Errorf("failed to get address bytes: %w", err) } - - if a.addressType == AddressTypeByron { - return addrBytes, nil - } return cbor.Encode(addrBytes) }