create coinbase transaction

This commit is contained in:
admin 2018-02-11 18:51:15 +04:00
parent a5de8d2c2d
commit aa63120489
2 changed files with 16 additions and 14 deletions

View File

@ -600,6 +600,7 @@ class Block():
self.target = None self.target = None
self.fee = 0 self.fee = 0
self.witness_root_hash = None self.witness_root_hash = None
if txs:
if txs[0].coinbase: if txs[0].coinbase:
if version > 1: if version > 1:
self.height = int.from_bytes(txs[0].tx_in[0].sig_script.raw[1:5], "little") self.height = int.from_bytes(txs[0].tx_in[0].sig_script.raw[1:5], "little")

View File

@ -439,6 +439,7 @@ def merkle_branches(tx_hash_list):
if len(new_hash_list) > 1: if len(new_hash_list) > 1:
tx_hash_list = new_hash_list tx_hash_list = new_hash_list
else: else:
if new_hash_list:
branches.append(new_hash_list.pop(0)) branches.append(new_hash_list.pop(0))
return branches return branches