mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-03 07:52:33 +02:00
Merge bitcoin/bitcoin#23723: test: Replace hashlib.new with named constructor
fa1b63c018
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: ACKfa1b63c018
w0xlt: ACKfa1b63c
Tree-SHA512: d23dc4552c1e6fc1f90f8272e47e4efcbe727f0b66a6f6a264db8a50ee6cb6d57a2809befcb95fda6725136672268633817a03dd1859f2298d20e3f9e0ca4a7f
This commit is contained in:
commit
09e60df115
@ -64,13 +64,15 @@ FILTER_TYPE_BASIC = 0
|
||||
|
||||
WITNESS_SCALE_FACTOR = 4
|
||||
|
||||
# Serialization/deserialization tools
|
||||
|
||||
def sha256(s):
|
||||
return hashlib.new('sha256', s).digest()
|
||||
return hashlib.sha256(s).digest()
|
||||
|
||||
|
||||
def hash256(s):
|
||||
return sha256(sha256(s))
|
||||
|
||||
|
||||
def ser_compact_size(l):
|
||||
r = b""
|
||||
if l < 253:
|
||||
|
Loading…
Reference in New Issue
Block a user