avoid memory alloc when padding (#1058)

also avoid stack state copy in test
This commit is contained in:
Jacek Sieka 2020-05-22 10:31:19 +02:00 committed by GitHub
parent 80b8416305
commit 681b399e2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -306,7 +306,7 @@ func mergeBranches(existing: Eth2Digest, newData: openarray[byte]): Eth2Digest =
let paddingBytes = bytesPerChunk - newData.len
if paddingBytes > 0:
trs "USING ", paddingBytes, " PADDING BYTES"
h.update zeroChunk[0 ..< paddingBytes]
h.update zeroChunk.toOpenArray(0, paddingBytes - 1)
trs "HASH RESULT ", result
template mergeBranches(a, b: Eth2Digest): Eth2Digest =