Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-integrate block producer into block-explorer example #334

Closed
deekerno opened this issue Nov 10, 2022 · 1 comment · Fixed by #430
Closed

Re-integrate block producer into block-explorer example #334

deekerno opened this issue Nov 10, 2022 · 1 comment · Fixed by #430
Assignees
Labels
good first issue Good for newcomers
Milestone

Comments

@deekerno
Copy link
Contributor

The producer field has been removed from the Block struct that is returned from fuel-gql-client; we should find a way to re-integrate that information back into the block explorer example.

@ra0x3 ra0x3 mentioned this issue Dec 5, 2022
16 tasks
@ra0x3 ra0x3 self-assigned this Dec 8, 2022
@deekerno
Copy link
Contributor Author

deekerno commented Dec 8, 2022

We will be able to re-integrate the block producer when the next version of fuel-gql-client is released:

impl Block {
    /// Returns the block producer public key, if any.
    pub fn block_producer(&self) -> Option<fuel_vm::fuel_crypto::PublicKey> {
        let message = self.header.id.clone().into_message();
        match &self.consensus {
            Consensus::Genesis(_) => Some(Default::default()),
            Consensus::PoAConsensus(poa) => {
                let signature = poa.signature.clone().into_signature();
                let producer_pub_key = signature.recover(&message);
                producer_pub_key.ok()
            }
            Consensus::Unknown => None,
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment