Skip to content

Commit d7914eb

Browse files
committed
feat: skipped the byron part and fixed golangci-lint errors
Signed-off-by: Akhil Repala <arepala@blinklabs.io>
1 parent 8768206 commit d7914eb

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

ledger/byron/byron.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ type ByronTransaction struct {
142142
hash *common.Blake2b256
143143
TxInputs []ByronTransactionInput
144144
TxOutputs []ByronTransactionOutput
145-
Attributes common.TransactionMetadatum
145+
Attributes cbor.RawMessage
146146
}
147147

148148
func (t *ByronTransaction) UnmarshalCBOR(cborData []byte) error {
@@ -276,7 +276,7 @@ func (t *ByronTransaction) Donation() uint64 {
276276
}
277277

278278
func (t *ByronTransaction) Metadata() common.TransactionMetadatum {
279-
return t.Attributes
279+
return nil
280280
}
281281

282282
func (t *ByronTransaction) LeiosHash() common.Blake2b256 {

ledger/common/metadata.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,20 @@ type TransactionMetadatum interface {
4343
}
4444

4545
type MetaInt struct{ Value int64 }
46+
4647
type MetaBytes struct{ Value []byte }
48+
4749
type MetaText struct{ Value string }
50+
4851
type MetaList struct {
4952
Items []TransactionMetadatum
5053
}
54+
5155
type MetaPair struct {
5256
Key TransactionMetadatum
5357
Value TransactionMetadatum
5458
}
59+
5560
type MetaMap struct {
5661
Pairs []MetaPair
5762
}
@@ -136,7 +141,7 @@ func DecodeMetadatumRaw(b []byte) (TransactionMetadatum, error) {
136141
func decodeMapUint(b []byte) (TransactionMetadatum, bool, error) {
137142
var m map[uint]cbor.RawMessage
138143
if _, err := cbor.Decode(b, &m); err != nil {
139-
return nil, false, nil // not this shape
144+
return nil, false, nil //nolint:nilerr // not this shape
140145
}
141146
pairs := make([]MetaPair, 0, len(m))
142147
for k, rv := range m {
@@ -155,7 +160,7 @@ func decodeMapUint(b []byte) (TransactionMetadatum, bool, error) {
155160
func decodeMapText(b []byte) (TransactionMetadatum, bool, error) {
156161
var m map[string]cbor.RawMessage
157162
if _, err := cbor.Decode(b, &m); err != nil {
158-
return nil, false, nil // not this shape
163+
return nil, false, nil //nolint:nilerr // not this shape
159164
}
160165
pairs := make([]MetaPair, 0, len(m))
161166
for k, rv := range m {
@@ -171,7 +176,7 @@ func decodeMapText(b []byte) (TransactionMetadatum, bool, error) {
171176
func decodeMapBytes(b []byte) (TransactionMetadatum, bool, error) {
172177
var m map[cbor.ByteString]cbor.RawMessage
173178
if _, err := cbor.Decode(b, &m); err != nil {
174-
return nil, false, nil
179+
return nil, false, nil //nolint:nilerr // not this shape
175180
}
176181
pairs := make([]MetaPair, 0, len(m))
177182
for k, rv := range m {

0 commit comments

Comments
 (0)