[bug] pairing: roles
needs validation when pairing
This commit is contained in:
parent
f95b6473e5
commit
544c3256d6
@ -1617,7 +1617,10 @@ pub fn get_update_proposals(process_outpoint: String) -> ApiResult<PcdUpdates> {
|
|||||||
None => None
|
None => None
|
||||||
};
|
};
|
||||||
|
|
||||||
let member = lock_local_device()?.to_member();
|
let device = lock_local_device()?;
|
||||||
|
let member = device.to_member();
|
||||||
|
|
||||||
|
let is_pairing = device.get_pairing_commitment().is_none();
|
||||||
|
|
||||||
for state in relevant_process.get_latest_concurrent_states()? {
|
for state in relevant_process.get_latest_concurrent_states()? {
|
||||||
if state.encrypted_pcd == Value::Null {
|
if state.encrypted_pcd == Value::Null {
|
||||||
@ -1635,7 +1638,7 @@ pub fn get_update_proposals(process_outpoint: String) -> ApiResult<PcdUpdates> {
|
|||||||
for (key, value) in &decrypted_pcd {
|
for (key, value) in &decrypted_pcd {
|
||||||
let previous_value = previous_state.get(key).or_else(|| Some(&Value::Null)).unwrap();
|
let previous_value = previous_state.get(key).or_else(|| Some(&Value::Null)).unwrap();
|
||||||
if previous_value == value { continue; }
|
if previous_value == value { continue; }
|
||||||
let need_validation = if fields_to_validate.iter().any(|f| *key == **f) { true } else { false };
|
let need_validation = if is_pairing && key.as_str() == "roles" { true } else { fields_to_validate.iter().any(|f| *key == **f) };
|
||||||
let notify_user = if need_validation { true } else if !value.is_hex_string() { true } else { false };
|
let notify_user = if need_validation { true } else if !value.is_hex_string() { true } else { false };
|
||||||
let diff = UserDiff {
|
let diff = UserDiff {
|
||||||
new_state_merkle_root: root.clone(),
|
new_state_merkle_root: root.clone(),
|
||||||
@ -1650,7 +1653,7 @@ pub fn get_update_proposals(process_outpoint: String) -> ApiResult<PcdUpdates> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (key, value) in &decrypted_pcd {
|
for (key, value) in &decrypted_pcd {
|
||||||
let need_validation = if fields_to_validate.iter().any(|f| *key == **f) { true } else { false };
|
let need_validation = if is_pairing && key.as_str() == "roles" { true } else { fields_to_validate.iter().any(|f| *key == **f) };
|
||||||
let notify_user = if need_validation { true } else if !value.is_hex_string() { true } else { false };
|
let notify_user = if need_validation { true } else if !value.is_hex_string() { true } else { false };
|
||||||
let diff = UserDiff {
|
let diff = UserDiff {
|
||||||
new_state_merkle_root: root.clone(),
|
new_state_merkle_root: root.clone(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user