diff --git a/common/eos/src/eos_crypto/eos_public_key.rs b/common/eos/src/eos_crypto/eos_public_key.rs index f8ff965d..885ff265 100644 --- a/common/eos/src/eos_crypto/eos_public_key.rs +++ b/common/eos/src/eos_crypto/eos_public_key.rs @@ -4,6 +4,7 @@ use common::{ errors::AppError, types::{Byte, Bytes, Result}, }; +use eos_chain::{PublicKey as EosCratePublicKey, UnsignedInt}; use secp256k1::{ self, key::{PublicKey, SecretKey}, @@ -18,6 +19,15 @@ use crate::{ eos_hash::ripemd160, }; +impl From for EosCratePublicKey { + fn from(pub_key: EosPublicKey) -> EosCratePublicKey { + EosCratePublicKey { + type_: UnsignedInt::default(), + data: pub_key.public_key.serialize(), + } + } +} + #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct EosPublicKey { pub compressed: bool, diff --git a/common/eos/src/eos_producer_schedule.rs b/common/eos/src/eos_producer_schedule.rs index a2a508ae..0ecef9a4 100644 --- a/common/eos/src/eos_producer_schedule.rs +++ b/common/eos/src/eos_producer_schedule.rs @@ -189,9 +189,10 @@ fn convert_keys_json_to_vec_of_eos_keys(keys_json: &[ProducerKeyJsonV2]) -> comm } fn convert_key_json_to_eos_key(key_json: &ProducerKeyJsonV2) -> common::Result { + let internal_eos_pub_key = crate::eos_crypto::eos_public_key::EosPublicKey::from_str(&key_json.key)?; Ok(EosKey { weight: key_json.weight, - key: EosPublicKey::from_str(&key_json.key)?, + key: internal_eos_pub_key.into(), }) }