@@ -78,7 +78,7 @@ func VerifyBlockBody(data string, blockBodyHash string) (bool, error) {
78
78
func CalculateBlockBodyHash (txsRaw [][]string ) ([]byte , error ) {
79
79
var txSeqBody []cbor.RawMessage
80
80
var txSeqWit []cbor.RawMessage
81
- txSeqMetadata := map [uint64 ]cbor. RawTag {}
81
+ txSeqMetadata := make ( map [uint64 ]interface {}, len ( txsRaw ))
82
82
txSeqNonValid := []uint {}
83
83
for index , tx := range txsRaw {
84
84
if len (tx ) != 3 {
@@ -121,11 +121,18 @@ func CalculateBlockBodyHash(txsRaw [][]string) ([]byte, error) {
121
121
auxBytesError .Error (),
122
122
)
123
123
}
124
- // Cardano use Tag 259 for this when encCbor
125
- // Ref: https://github.com/IntersectMBO/cardano-ledger/blob/master/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxAuxData.hs#L125
126
- txSeqMetadata [uint64 (index )] = cbor.RawTag {
127
- Number : 259 , Content : auxBytes ,
124
+
125
+ var auxInterface interface {}
126
+ _ , auxDecodeError := cbor .Decode (auxBytes , & auxInterface )
127
+ if auxDecodeError != nil {
128
+ return nil , fmt .Errorf (
129
+ "CalculateBlockBodyHash: decode aux tx[%v] error, %v" ,
130
+ index ,
131
+ auxDecodeError .Error (),
132
+ )
128
133
}
134
+
135
+ txSeqMetadata [uint64 (index )] = auxInterface
129
136
}
130
137
// TODO: should form nonValid TX here
131
138
}
0 commit comments