(self, block_number, new_transactions, *, nTime=None)
| 1404 | |
| 1405 | # adds transactions to the block and updates state |
| 1406 | def update_block(self, block_number, new_transactions, *, nTime=None): |
| 1407 | block = self.blocks[block_number] |
| 1408 | self.add_transactions_to_block(block, new_transactions) |
| 1409 | old_hash_int = block.hash_int |
| 1410 | if nTime is not None: |
| 1411 | block.nTime = nTime |
| 1412 | block.hashMerkleRoot = block.calc_merkle_root() |
| 1413 | has_witness_tx = any(not tx.wit.is_null() for tx in block.vtx) |
| 1414 | if has_witness_tx: |
| 1415 | add_witness_commitment(block) |
| 1416 | block.solve() |
| 1417 | # Update the internal state just like in next_block |
| 1418 | self.tip = block |
| 1419 | if block.hash_int != old_hash_int: |
| 1420 | self.block_heights[block.hash_int] = self.block_heights[old_hash_int] |
| 1421 | del self.block_heights[old_hash_int] |
| 1422 | self.blocks[block_number] = block |
| 1423 | return block |
| 1424 | |
| 1425 | def bootstrap_p2p(self, timeout=10): |
| 1426 | """Add a P2P connection to the node. |
no test coverage detected