create coinbase transaction
This commit is contained in:
parent
841d68bd18
commit
448a3e82e5
@ -618,7 +618,7 @@ class Block():
|
|||||||
wtxid_list = [b"\x00" * 32,]
|
wtxid_list = [b"\x00" * 32,]
|
||||||
for tx in self.transactions[0 if not self.transactions[0].coinbase else 1:]:
|
for tx in self.transactions[0 if not self.transactions[0].coinbase else 1:]:
|
||||||
wtxid_list.append(tx.whash)
|
wtxid_list.append(tx.whash)
|
||||||
return double_sha256(merkleroot(wtxid_list[::-1]) + b"\x00" * 32)
|
return double_sha256(merkleroot(wtxid_list[::-1]) + self.transactions[0].witness[0].serialize())
|
||||||
|
|
||||||
def create_coinbase_transaction(self, block_height, outputs, coinbase_message = b"", insert = True):
|
def create_coinbase_transaction(self, block_height, outputs, coinbase_message = b"", insert = True):
|
||||||
tx = Transaction(version = 1,tx_in = [], tx_out = [], witness= [] )
|
tx = Transaction(version = 1,tx_in = [], tx_out = [], witness= [] )
|
||||||
@ -665,3 +665,5 @@ class Block():
|
|||||||
}
|
}
|
||||||
return cls(**kwargs)
|
return cls(**kwargs)
|
||||||
|
|
||||||
|
# class BlockTemplate():
|
||||||
|
# def __init__(self, data):
|
||||||
|
|||||||
575
test/block.py
575
test/block.py
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user