feat(primitives): use with_capacity for sighash (#108)

This commit is contained in:
Dan Cline
2022-10-20 04:26:08 -04:00
committed by GitHub
parent c277015f5c
commit 4536e09c99

View File

@ -130,7 +130,7 @@ impl Transaction {
/// Heavy operation that return hash over rlp encoded transaction.
/// It is only used for signature signing.
pub fn signature_hash(&self) -> TxHash {
let mut encoded = vec![];
let mut encoded = Vec::with_capacity(self.length());
self.encode(&mut encoded);
keccak256(encoded).into()
}