Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Expose current_block_num to contracts #6695

@jnordberg

Description

@jnordberg

Having access to the pending block number inside a contract can be useful in certain cases.

It should be possible to expose it in the system_api just like current_time e.g.:

uint64_t current_block_num() {
    return static_cast<uint64_t>( context.control.pending_block_state()->block_num );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    CONSENSUSIntroduces a change that may modify consensus protocol rules on an existing blockchain.enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions