Skip to content

Commit 769d1dd

Browse files
feat: partial bincode support (#30)
* feat: partial bincode support * feat: partial bincode support --------- Co-authored-by: Ivan Shumkov <[email protected]>
1 parent 671348d commit 769d1dd

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ jsonrpc = "0.14.0"
2727

2828
# Used for deserialization of JSON.
2929
serde = { version = "1.0.132", features = ["derive"] }
30-
serde_json = { version="1.0", features=["preserve_order"] }
30+
serde_json = { version="1.0", features=["preserve_order"] }

json/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ serde_repr = "0.1"
2626
hex = { version="0.4", features=["serde"]}
2727

2828
dashcore = { git="https://github.com/dashpay/rust-dashcore", features=["std", "secp-recovery", "rand", "signer", "use-serde"], default-features = false, branch = "feat/addons" }
29+
30+
bincode = { version = "2.0.0-rc.3", features = ["serde"] }

json/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use std::fmt;
2929
use std::fmt::{Display, Formatter};
3030
use std::net::SocketAddr;
3131
use std::str::FromStr;
32+
use bincode::{Decode, Encode};
3233

3334
use dashcore::consensus::encode;
3435
use dashcore::hashes::hex::Error::InvalidChar;
@@ -2028,7 +2029,7 @@ pub struct Masternode {
20282029

20292030
// TODO: clean up the new structure + test deserialization
20302031

2031-
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
2032+
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize, Encode, Decode)]
20322033
pub enum MasternodeType {
20332034
Regular,
20342035
HighPerformance,
@@ -2480,7 +2481,7 @@ pub struct BLS {
24802481

24812482
// --------------------------- Quorum -------------------------------
24822483

2483-
#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize_repr, Hash)]
2484+
#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize_repr, Hash, Encode, Decode)]
24842485
#[repr(u8)]
24852486
pub enum QuorumType {
24862487
Llmq50_60 = 1,
@@ -2567,11 +2568,12 @@ impl From<&str> for QuorumType {
25672568
}
25682569
}
25692570

2570-
#[derive(Clone, PartialEq, Debug, Deserialize, Serialize)]
2571+
#[derive(Clone, PartialEq, Debug, Deserialize, Serialize, Encode, Decode)]
25712572
#[serde(rename_all = "camelCase")]
25722573
pub struct ExtendedQuorumDetails {
25732574
pub creation_height: u32,
25742575
pub quorum_index: Option<u32>,
2576+
#[bincode(with_serde)]
25752577
pub mined_block_hash: BlockHash,
25762578
pub num_valid_members: u32,
25772579
#[serde(deserialize_with = "deserialize_f32")]

0 commit comments

Comments
 (0)