mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
check for Intitialized changed
Signed-off-by: Rajat Sharma <connecttorajat@outlook.com>
This commit is contained in:
parent
adfd850e64
commit
ef42c0a094
1 changed files with 3 additions and 3 deletions
|
|
@ -312,7 +312,7 @@ class TokenERC721Contract extends Contract {
|
|||
|
||||
//check contract options are not already set, client is not authorized to change them once intitialized
|
||||
const nameBytes = await ctx.stub.getState(nameKey);
|
||||
if (nameBytes !== undefined) {
|
||||
if (!nameBytes || nameBytes.length !== 0) {
|
||||
throw new Error('contract options are already set, client is not authorized to change them');
|
||||
}
|
||||
|
||||
|
|
@ -455,10 +455,10 @@ class TokenERC721Contract extends Contract {
|
|||
//Checks that contract options have been already initialized
|
||||
async CheckIntitialized(ctx){
|
||||
const nameBytes = await ctx.stub.getState(nameKey);
|
||||
if (nameBytes === undefined) {
|
||||
if (!nameBytes || nameBytes.length === 0) {
|
||||
throw new Error('contract options need to be set before calling any function, call Initialize() to initialize contract');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TokenERC721Contract;
|
||||
module.exports = TokenERC721Contract;
|
||||
|
|
|
|||
Loading…
Reference in a new issue