Make CBlock.get_merkle_root static

We'll later need this method to calculate merkle roots outside of CBlock.
I'd like to avoid moving this code outside of CBlock as it might later
conflict with Bitcoin backports.
This commit is contained in:
Alexander Block 2019-04-04 08:03:21 +02:00
parent 1e0bdbc9b7
commit 585b9c2818

View File

@ -549,7 +549,8 @@ class CBlock(CBlockHeader):
return r
# Calculate the merkle root given a vector of transaction hashes
def get_merkle_root(self, hashes):
@staticmethod
def get_merkle_root(hashes):
while len(hashes) > 1:
newhashes = []
for i in range(0, len(hashes), 2):