Skip to content
Prev Previous commit
Next Next commit
Improve web3name logic
  • Loading branch information
ntn-x2 committed Dec 12, 2023
commit c90b64b577407f661dd2fe810dfa537d73d3009f
13 changes: 6 additions & 7 deletions runtimes/common/src/dip/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,18 @@ pub mod v0 {
.collect::<Result<Vec<_>, _>>()?;

match (should_include_web3_name, web3_name_details) {
// If web3name should be included and it exists...
// If web3name should be included and it exists, add to the leaves to be revealed...
(true, Some(web3name_details)) => {
leaves.push(RevealedDidMerkleProofLeaf::Web3Name(
web3name_details.web3_name.clone().into(),
web3name_details.claimed_at.into(),
));
Ok(())
}
// ...else if web3name should be included and it DOES NOT exist...
(true, None) => Err(DidMerkleProofError::Web3NameNotFound),
// ...else (if web3name should NOT be included).
(false, _) => Ok(()),
}?;
// ...else if web3name should be included and it DOES NOT exist, return an error...
(true, None) => return Err(DidMerkleProofError::Web3NameNotFound),
// ...else (if web3name should NOT be included), skip.
(false, _) => {}
};

let encoded_keys: Vec<Vec<u8>> = leaves.iter().map(|l| l.encoded_key()).collect();
let proof =
Expand Down