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

Method writeTo

protocol/bc/legacy/block.go:127–135  ·  view source on GitHub ↗

assumes w has sticky errors

(w io.Writer, serflags uint8)

Source from the content-addressed store, hash-verified

125
126// assumes w has sticky errors
127func (b *Block) writeTo(w io.Writer, serflags uint8) {
128 b.BlockHeader.writeTo(w, serflags)
129 if serflags&SerBlockTransactions == SerBlockTransactions {
130 blockchain.WriteVarint31(w, uint64(len(b.Transactions))) // TODO(bobg): check and return error
131 for _, tx := range b.Transactions {
132 tx.WriteTo(w)
133 }
134 }
135}

Callers 8

WriteToMethod · 0.95
BenchmarkTxWriteToTrueFunction · 0.45
BenchmarkTxWriteToFalseFunction · 0.45
logRequestDataMethod · 0.45

Calls 1

WriteToMethod · 0.45

Tested by 6

BenchmarkTxWriteToTrueFunction · 0.36
BenchmarkTxWriteToFalseFunction · 0.36