Skip to content

Commit 9ba5f28

Browse files
authored
fix: Byron address CBOR encoding (#1068)
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 <[email protected]>
1 parent 2f1c60c commit 9ba5f28

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

ledger/byron/genesis.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"slices"
2323
"strconv"
2424

25-
"github.com/blinklabs-io/gouroboros/cbor"
2625
"github.com/blinklabs-io/gouroboros/ledger/common"
2726
)
2827

@@ -123,7 +122,7 @@ func (g *ByronGenesis) avvmUtxos() ([]common.Utxo, error) {
123122
if err != nil {
124123
return nil, err
125124
}
126-
addrBytes, err := cbor.Encode(tmpAddr)
125+
addrBytes, err := tmpAddr.Bytes()
127126
if err != nil {
128127
return nil, err
129128
}
@@ -155,7 +154,7 @@ func (g *ByronGenesis) nonAvvmUtxos() ([]common.Utxo, error) {
155154
if err != nil {
156155
return nil, err
157156
}
158-
addrBytes, err := cbor.Encode(tmpAddr)
157+
addrBytes, err := tmpAddr.Bytes()
159158
if err != nil {
160159
return nil, err
161160
}

ledger/common/address.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,6 @@ func (a *Address) MarshalCBOR() ([]byte, error) {
282282
if err != nil {
283283
return nil, fmt.Errorf("failed to get address bytes: %w", err)
284284
}
285-
286-
if a.addressType == AddressTypeByron {
287-
return addrBytes, nil
288-
}
289285
return cbor.Encode(addrBytes)
290286
}
291287

0 commit comments

Comments
 (0)