"Any idea why the following snippet of code might be unable to unwrap the cbor?
func getTxIdHex(txRawBytes []byte) (string, error) {
// Unwrap raw transaction bytes into a CBOR array
var txUnwrap []cbor.RawMessage
if err := cbor.Unmarshal(txRawBytes, &txUnwrap); err != nil {
return "", err
}
// index 0 is the transaction body
// Store index 0 (transaction body) as byte array
txBody := txUnwrap[0]
// Convert the body into a blake2b256 hash string
txIdHash := blake2b.Sum256(txBody)
// Encode hash string as byte array to hex string
txIdHex := hex.EncodeToString(txIdHash[:])
return txIdHex, nil
}
Error: cbor: 8 bytes of extraneous data starting at index 1
Reported via Discord (latest gOuroboros):
"Any idea why the following snippet of code might be unable to unwrap the cbor?
Error:
cbor: 8 bytes of extraneous data starting at index 1
Transactions are indeed valid. Here is an example where it was unable to unwrap yet the tx went through: https://preprod.cardanoscan.io/transaction/ac935bfaaeb0b8b5bd379d220c37dd02ddda004e752f86bd779eed48d33fab22"
We tried switching to deserializing to a ledger.Transaction with Hash() and are still seeing the same behavior.
"github.com/blinklabs-io/gouroboros v0.89.1
"
Add this transaction to the unit tests when we resolve this issue.