Last active
August 7, 2021 13:01
-
-
Save pandulaDW/acb5e1031c837c25428e846cecf05e07 to your computer and use it in GitHub Desktop.
encoding each transaction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// writing the length of the encoded item before writing the data | |
buf := make([]byte, 4) | |
binary.LittleEndian.PutUint32(buf, uint32(len(encodedData))) | |
if _, err := outFile.Write(buf); err != nil { | |
return err | |
} | |
// writing the actual transaction item to the file | |
if _, err := outFile.Write(encodedData); err != nil { | |
return err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment