Skip to content

Commit

Permalink
fix: more fixes for serde
Browse files Browse the repository at this point in the history
  • Loading branch information
knst committed Aug 27, 2024
1 parent da69194 commit d1cec6a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dash-spv-masternode-processor/src/bindings/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crate::processing::keys_cache::KeysCache;
use crate::types::opaque_key::{AsCStringPtr, AsOpaqueKey, OpaqueKey, KeyWithUniqueId, OpaqueKeys, OpaqueSerializedKeys};
use crate::util::address::address;
use crate::util::sec_vec::SecVec;
#[cfg(feature = "use_serde")]
use serde::{Deserialize, Deserializer, Serialize, Serializer};

/// Destroys
Expand Down Expand Up @@ -503,7 +504,6 @@ pub unsafe extern "C" fn key_bls_chaincode(key: *mut BLSKey) -> ByteArray {

/// # Safety
#[no_mangle]
#[cfg(feature = "use_serde")]
pub unsafe extern "C" fn key_bls_serialize(key: *mut BLSKey, legacy: bool) -> ByteArray {
(&*key).bls_public_key()
.map(|key| UInt384(*if legacy { key.serialize_legacy() } else { key.serialize() }))
Expand Down
4 changes: 1 addition & 3 deletions dash-spv-masternode-processor/src/keys/bls_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::keys::{IKey, KeyKind, dip14::{IChildKeyDerivation, SignKey}};
use crate::keys::crypto_data::{CryptoData, DHKey};
use crate::models::OperatorPublicKey;
use crate::util::{base58, data_ops::hex_with_data, sec_vec::SecVec};
#[cfg(feature = "use_serde")]
use serde::{Deserialize, Deserializer, Serialize, Serializer};

#[derive(Clone, Debug, Default)]
Expand Down Expand Up @@ -172,7 +173,6 @@ impl BLSKey {
}
}

#[cfg(feature = "use_serde")]
pub fn key_with_seed_data(seed: &[u8], use_legacy: bool) -> Self {
let bls_private_key = PrivateKey::from_bip32_seed(seed);
let bls_public_key = bls_private_key.g1_element().unwrap();
Expand Down Expand Up @@ -556,7 +556,6 @@ fn g1_element_from_bytes(use_legacy: bool, bytes: &[u8]) -> Result<G1Element, Bl
}
}

#[cfg(feature = "use_serde")]
fn g1_element_serialized(public_key: &G1Element, use_legacy: bool) -> [u8; 48] {
*if use_legacy {
public_key.serialize_legacy()
Expand All @@ -565,7 +564,6 @@ fn g1_element_serialized(public_key: &G1Element, use_legacy: bool) -> [u8; 48] {
}
}

#[cfg(feature = "use_serde")]
fn g2_element_serialized(signature: &G2Element, use_legacy: bool) -> [u8; 96] {
*if use_legacy {
signature.serialize_legacy()
Expand Down
1 change: 1 addition & 0 deletions dash-spv-masternode-processor/src/keys/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::crypto::{UInt256, UInt384, UInt768};
use crate::keys::{BLSKey, ECDSAKey, ED25519Key, IKey};
use crate::types::opaque_key::{AsOpaqueKey, OpaqueKey};
use crate::util::sec_vec::SecVec;
#[cfg(feature = "use_serde")]
use serde::{Deserialize, Deserializer, Serialize, Serializer};

#[repr(C)]
Expand Down
1 change: 1 addition & 0 deletions dash-spv-masternode-processor/src/tests/bindings/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::crypto::{UInt256, UInt384};
use crate::ffi::IndexPathData;
use crate::keys::KeyKind;
use crate::types::opaque_key::OpaqueKey;
#[cfg(feature = "use_serde")]
use serde::{Deserialize, Deserializer, Serialize, Serializer};

#[test]
Expand Down

0 comments on commit d1cec6a

Please sign in to comment.