MCPcopy Create free account
hub / github.com/chain/Core / WriteVarstrList

Function WriteVarstrList

encoding/blockchain/blockchain.go:172–185  ·  view source on GitHub ↗

WriteVarstrList writes a varint31 length prefix followed by the elements of l as varstrs.

(w io.Writer, l [][]byte)

Source from the content-addressed store, hash-verified

170// WriteVarstrList writes a varint31 length prefix followed by the
171// elements of l as varstrs.
172func WriteVarstrList(w io.Writer, l [][]byte) (int, error) {
173 n, err := WriteVarint31(w, uint64(len(l)))
174 if err != nil {
175 return n, err
176 }
177 for _, s := range l {
178 n2, err := WriteVarstr31(w, s)
179 n += n2
180 if err != nil {
181 return n, err
182 }
183 }
184 return n, err
185}
186
187// WriteExtensibleString sends the output of the given function, plus
188// the given suffix, to w, together with a varint31 length prefix.

Callers 2

TestVarstrListFunction · 0.85
TestReadWriteVarstrListFunction · 0.85

Calls 2

WriteVarint31Function · 0.85
WriteVarstr31Function · 0.85

Tested by 2

TestVarstrListFunction · 0.68
TestReadWriteVarstrListFunction · 0.68