mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-19 23:21:46 +03:00
3b084a165b
* configure isort to add the future annotations import * apply the new isort setting * remove type ignores for new mypy (#13539) https://pypi.org/project/mypy/0.981/ * another
24 lines
712 B
Python
24 lines
712 B
Python
from __future__ import annotations
|
|
|
|
from typing import Tuple
|
|
|
|
from chia.consensus.block_record import BlockRecord
|
|
from chia.consensus.blockchain_interface import BlockchainInterface
|
|
from chia.util.ints import uint128
|
|
|
|
|
|
def get_prev_transaction_block(
|
|
curr: BlockRecord,
|
|
blocks: BlockchainInterface,
|
|
total_iters_sp: uint128,
|
|
) -> Tuple[bool, BlockRecord]:
|
|
prev_transaction_block = curr
|
|
while not curr.is_transaction_block:
|
|
curr = blocks.block_record(curr.prev_hash)
|
|
if total_iters_sp > curr.total_iters:
|
|
prev_transaction_block = curr
|
|
is_transaction_block = True
|
|
else:
|
|
is_transaction_block = False
|
|
return is_transaction_block, prev_transaction_block
|