Пример #1
0
def create_byzantium_header_from_parent(parent_header, **header_params):
    if 'difficulty' not in header_params:
        header_params.setdefault('timestamp', parent_header.timestamp + 1)

        header_params['difficulty'] = compute_byzantium_difficulty(
            parent_header=parent_header,
            timestamp=header_params['timestamp'],
        )
    return create_frontier_header_from_parent(parent_header, **header_params)
Пример #2
0
def create_byzantium_header_from_parent(parent_header, **header_params):
    if 'difficulty' not in header_params:
        header_params.setdefault('timestamp', parent_header.timestamp + 1)

        header_params['difficulty'] = compute_byzantium_difficulty(
            parent_header=parent_header,
            timestamp=header_params['timestamp'],
        )
    return create_frontier_header_from_parent(parent_header, **header_params)
Пример #3
0
def create_homestead_header_from_parent(parent_header, **header_params):
    if 'difficulty' not in header_params:
        # Use setdefault to ensure the new header has the same timestamp we use to calculate its
        # difficulty.
        header_params.setdefault('timestamp', parent_header.timestamp + 1)
        header_params['difficulty'] = compute_homestead_difficulty(
            parent_header,
            header_params['timestamp'],
        )
    return create_frontier_header_from_parent(parent_header, **header_params)
Пример #4
0
def create_homestead_header_from_parent(parent_header, **header_params):
    if 'difficulty' not in header_params:
        # Use setdefault to ensure the new header has the same timestamp we use to calculate its
        # difficulty.
        header_params.setdefault('timestamp', parent_header.timestamp + 1)
        header_params['difficulty'] = compute_homestead_difficulty(
            parent_header,
            header_params['timestamp'],
        )
    return create_frontier_header_from_parent(parent_header, **header_params)