MCPcopy Create free account
hub / github.com/ElementsProject/elements / update_block

Method update_block

test/functional/feature_block.py:1438–1450  ·  view source on GitHub ↗
(self, block_number, new_transactions)

Source from the content-addressed store, hash-verified

1436
1437 # adds transactions to the block and updates state
1438 def update_block(self, block_number, new_transactions):
1439 block = self.blocks[block_number]
1440 self.add_transactions_to_block(block, new_transactions)
1441 old_sha256 = block.sha256
1442 block.hashMerkleRoot = block.calc_merkle_root()
1443 block.solve()
1444 # Update the internal state just like in next_block
1445 self.tip = block
1446 if block.sha256 != old_sha256:
1447 self.block_heights[block.sha256] = self.block_heights[old_sha256]
1448 del self.block_heights[old_sha256]
1449 self.blocks[block_number] = block
1450 return block
1451
1452 def bootstrap_p2p(self, timeout=10):
1453 """Add a P2P connection to the node.

Callers 1

run_testMethod · 0.95

Calls 3

calc_merkle_rootMethod · 0.45
solveMethod · 0.45

Tested by

no test coverage detected