Skip to content

Commit

Permalink
revert: handle operator payout address change in get_protx_listdiff (#45
Browse files Browse the repository at this point in the history
)

This reverts commit ca61af3.
  • Loading branch information
QuantumExplorer authored Jul 31, 2024
1 parent 1fdb29b commit bd6efdb
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions json/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2106,7 +2106,7 @@ pub struct DMNStateDiff {
pub voting_address: Option<[u8; 20]>,
pub payout_address: Option<[u8; 20]>,
pub pub_key_operator: Option<Vec<u8>>,
pub operator_payout_address: Option<[u8; 20]>,
pub operator_payout_address: Option<Option<[u8; 20]>>,
pub platform_node_id: Option<[u8; 20]>,
pub platform_p2p_port: Option<u32>,
pub platform_http_port: Option<u32>,
Expand All @@ -2131,7 +2131,6 @@ impl TryFrom<DMNStateDiffIntermediate> for DMNStateDiff {
platform_p2p_port,
platform_http_port,
payout_address,
operator_payout_address,
pub_key_operator,
} = value;

Expand Down Expand Up @@ -2162,15 +2161,7 @@ impl TryFrom<DMNStateDiffIntermediate> for DMNStateDiff {
})
})
.transpose()?;
let operator_payout_address = operator_payout_address
.map(|address| {
let address = Address::from_str(address.as_str())?;
address.payload_to_vec().try_into().map_err(|_| encode::Error::InvalidVectorSize {
expected: 20,
actual: address.payload_to_vec().len(),
})
})
.transpose()?;
let operator_payout_address = None; //todo

let platform_node_id = platform_node_id
.map(|address| {
Expand Down Expand Up @@ -2273,7 +2264,7 @@ impl DMNState {
!= newer.operator_payout_address
{
has_diff = true;
newer.operator_payout_address
Some(newer.operator_payout_address)
} else {
None
},
Expand Down Expand Up @@ -2342,7 +2333,9 @@ impl DMNState {
if let Some(payout_address) = payout_address {
self.payout_address = payout_address;
}
self.operator_payout_address = operator_payout_address;
if let Some(operator_payout_address) = operator_payout_address {
self.operator_payout_address = operator_payout_address;
}
if let Some(platform_node_id) = platform_node_id {
self.platform_node_id = Some(platform_node_id);
}
Expand Down Expand Up @@ -2894,8 +2887,6 @@ pub struct DMNStateDiffIntermediate {
pub platform_http_port: Option<u32>,
#[serde(default)]
pub payout_address: Option<String>,
#[serde(default)]
pub operator_payout_address: Option<String>,
#[serde(default, deserialize_with = "deserialize_hex_opt")]
pub pub_key_operator: Option<Vec<u8>>,
}
Expand Down

0 comments on commit bd6efdb

Please sign in to comment.