commit 30bc9d97db280a915f0e0c659451b519421a4f40
parent 5e0b35e36786438d6a6c6165aa7df887bd211a02
Author: parazyd <parazyd@dyne.org>
Date: Fri, 16 Apr 2021 01:44:03 +0200
Use existing utility function in merkle_branch.
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/obelisk/merkle.py b/obelisk/merkle.py
@@ -17,7 +17,7 @@
"""Module for calculating merkle branches"""
from math import ceil, log
-from obelisk.util import double_sha256
+from obelisk.util import double_sha256, hash_to_hex_str
def branch_length(hash_count):
@@ -64,5 +64,4 @@ def merkle_branch_and_root(hashes, index, length=None):
def merkle_branch(tx_hashes, tx_pos):
"""Return a merkle branch given hashes and the tx position"""
branch, _ = merkle_branch_and_root(tx_hashes, tx_pos)
- branch = [bytes(reversed(h)).hex() for h in branch]
- return branch
+ return [hash_to_hex_str(h) for h in branch]