From eee3b3df5ec813338fe86288fd22db18ded7dd1a Mon Sep 17 00:00:00 2001 From: Lyndon Shi Date: Tue, 13 Sep 2022 03:21:56 -0700 Subject: [PATCH] Fix operator resolve.js to not throw on undefined member data (#4222) --- samples/constitutions/operator/resolve.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/samples/constitutions/operator/resolve.js b/samples/constitutions/operator/resolve.js index a4752e1f6..3be896686 100644 --- a/samples/constitutions/operator/resolve.js +++ b/samples/constitutions/operator/resolve.js @@ -7,8 +7,11 @@ function getMemberInfo(memberId) { // Returns true if the member is a recovery member. function isRecoveryMember(memberId) { - const info = getMemberInfo(memberId); - if (info.member_data.encryption_pub_key) { + const key = ccf.strToBuf(memberId); + const value = + ccf.kv["public:ccf.gov.members.encryption_public_keys"].get(key); + + if (value) { return true; } return false; @@ -21,7 +24,7 @@ function isOperator(memberId) { return false; } const info = getMemberInfo(memberId); - return info.member_data.is_operator; + return info.member_data && info.member_data.is_operator; } // Defines actions that can be passed with sole operator input.