vm: add bufBinWriter to emit functions in order to catch errors

This commit is contained in:
Vsevolod Brekelov 2019-11-22 13:06:32 +03:00
parent 821c9b2851
commit d02673c112
6 changed files with 93 additions and 57 deletions

View file

@ -93,6 +93,11 @@ func (w *BinWriter) WriteVarUint(val uint64) {
}
// WriteVarBytes writes a variable byte into the underlying io.Writer without prefix.
func (w *BinWriter) WriteVarBytes(b []byte) {
w.WriteLE(b)
}
// WriteBytes writes a variable length byte array into the underlying io.Writer.
func (w *BinWriter) WriteBytes(b []byte) {
w.WriteVarUint(uint64(len(b)))