Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-transaction-ordering.py
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# get an output that we previously marked as spendable | # get an output that we previously marked as spendable | ||||
def get_spendable_output(): | def get_spendable_output(): | ||||
return PreviousSpendableOutput(spendable_outputs.pop(0).vtx[0], 0) | return PreviousSpendableOutput(spendable_outputs.pop(0).vtx[0], 0) | ||||
# move the tip back to a previous block | # move the tip back to a previous block | ||||
def tip(number): | def tip(number): | ||||
self.tip = self.blocks[number] | self.tip = self.blocks[number] | ||||
# adds transactions to the block and updates state | # update block state | ||||
def update_block(block_number, new_transactions=[]): | def update_block(block_number): | ||||
block = self.blocks[block_number] | block = self.blocks[block_number] | ||||
self.add_transactions_to_block(block, new_transactions) | |||||
old_sha256 = block.sha256 | old_sha256 = block.sha256 | ||||
block.hashMerkleRoot = block.calc_merkle_root() | block.hashMerkleRoot = block.calc_merkle_root() | ||||
block.solve() | block.solve() | ||||
# Update the internal state just like in next_block | # Update the internal state just like in next_block | ||||
self.tip = block | self.tip = block | ||||
if block.sha256 != old_sha256: | if block.sha256 != old_sha256: | ||||
self.block_heights[block.sha256] = self.block_heights[old_sha256] | self.block_heights[block.sha256] = self.block_heights[old_sha256] | ||||
del self.block_heights[old_sha256] | del self.block_heights[old_sha256] | ||||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |