consensus: don't use WriteArray for PrepareRequests

It's convenient, but it's not efficient due to reflection use.
This commit is contained in:
Roman Khimov 2022-06-01 11:55:16 +03:00
parent b0744c2b21
commit 54f75bb999

View file

@ -26,7 +26,10 @@ func (p *prepareRequest) EncodeBinary(w *io.BinWriter) {
w.WriteBytes(p.prevHash[:])
w.WriteU64LE(p.timestamp)
w.WriteU64LE(p.nonce)
w.WriteArray(p.transactionHashes)
w.WriteVarUint(uint64(len(p.transactionHashes)))
for i := range p.transactionHashes {
w.WriteBytes(p.transactionHashes[i][:])
}
if p.stateRootEnabled {
w.WriteBytes(p.stateRoot[:])
}