mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-12 07:14:20 +00:00
avoid memory alloc when padding (#1058)
also avoid stack state copy in test
This commit is contained in:
parent
80b8416305
commit
681b399e2a
@ -306,7 +306,7 @@ func mergeBranches(existing: Eth2Digest, newData: openarray[byte]): Eth2Digest =
|
|||||||
let paddingBytes = bytesPerChunk - newData.len
|
let paddingBytes = bytesPerChunk - newData.len
|
||||||
if paddingBytes > 0:
|
if paddingBytes > 0:
|
||||||
trs "USING ", paddingBytes, " PADDING BYTES"
|
trs "USING ", paddingBytes, " PADDING BYTES"
|
||||||
h.update zeroChunk[0 ..< paddingBytes]
|
h.update zeroChunk.toOpenArray(0, paddingBytes - 1)
|
||||||
trs "HASH RESULT ", result
|
trs "HASH RESULT ", result
|
||||||
|
|
||||||
template mergeBranches(a, b: Eth2Digest): Eth2Digest =
|
template mergeBranches(a, b: Eth2Digest): Eth2Digest =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user