From 073d6d6b2a6eb2741fe461884574c671858e6cda Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 9 Dec 2021 15:44:40 +0100 Subject: [PATCH] Merge bitcoin/bitcoin#23723: test: Replace hashlib.new with named constructor fa1b63c01887adff83f16b1bbba3bd159dc51104 test: Replace hashlib.new with named constructor (MarcoFalke) Pull request description: A small refactor that doesn't matter too much, but it using the named constructor is nice because: * It clarifies that it is a built-in function * It is (trivially) faster and less code. ACKs for top commit: Zero-1729: ACK fa1b63c01887adff83f16b1bbba3bd159dc51104 w0xlt: ACK fa1b63c Tree-SHA512: d23dc4552c1e6fc1f90f8272e47e4efcbe727f0b66a6f6a264db8a50ee6cb6d57a2809befcb95fda6725136672268633817a03dd1859f2298d20e3f9e0ca4a7f --- test/functional/test_framework/messages.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index 0804b87873..fe5123d4ac 100755 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -61,9 +61,9 @@ MSG_TYPE_MASK = 0xffffffff >> 2 FILTER_TYPE_BASIC = 0 -# Serialization/deserialization tools def sha256(s): - return hashlib.new('sha256', s).digest() + return hashlib.sha256(s).digest() + def hash256(s):