{"action":"created","issue":{"url":"https://api.github.com/repos/hyperledger/fabric/issues/936","repository_url":"https://api.github.com/repos/hyperledger/fabric","labels_url":"https://api.github.com/repos/hyperledger/fabric/issues/936/labels{/name}","comments_url":"https://api.github.com/repos/hyperledger/fabric/issues/936/comments","events_url":"https://api.github.com/repos/hyperledger/fabric/issues/936/events","html_url":"https://github.com/hyperledger/fabric/issues/936","id":145303026,"number":936,"title":"Chaincode shim `GetState` routine should return an indication of whether the key was found in the database","user":{"login":"bcbrock","id":11968347,"avatar_url":"https://avatars.githubusercontent.com/u/11968347?v=3","gravatar_id":"","url":"https://api.github.com/users/bcbrock","html_url":"https://github.com/bcbrock","followers_url":"https://api.github.com/users/bcbrock/followers","following_url":"https://api.github.com/users/bcbrock/following{/other_user}","gists_url":"https://api.github.com/users/bcbrock/gists{/gist_id}","starred_url":"https://api.github.com/users/bcbrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcbrock/subscriptions","organizations_url":"https://api.github.com/users/bcbrock/orgs","repos_url":"https://api.github.com/users/bcbrock/repos","events_url":"https://api.github.com/users/bcbrock/events{/privacy}","received_events_url":"https://api.github.com/users/bcbrock/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hyperledger/fabric/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/hyperledger/fabric/labels/chaincode","name":"chaincode","color":"006b75"},{"url":"https://api.github.com/repos/hyperledger/fabric/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":{"login":"murali-katipalli-dtcc","id":16924968,"avatar_url":"https://avatars.githubusercontent.com/u/16924968?v=3","gravatar_id":"","url":"https://api.github.com/users/murali-katipalli-dtcc","html_url":"https://github.com/murali-katipalli-dtcc","followers_url":"https://api.github.com/users/murali-katipalli-dtcc/followers","following_url":"https://api.github.com/users/murali-katipalli-dtcc/following{/other_user}","gists_url":"https://api.github.com/users/murali-katipalli-dtcc/gists{/gist_id}","starred_url":"https://api.github.com/users/murali-katipalli-dtcc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/murali-katipalli-dtcc/subscriptions","organizations_url":"https://api.github.com/users/murali-katipalli-dtcc/orgs","repos_url":"https://api.github.com/users/murali-katipalli-dtcc/repos","events_url":"https://api.github.com/users/murali-katipalli-dtcc/events{/privacy}","received_events_url":"https://api.github.com/users/murali-katipalli-dtcc/received_events","type":"User","site_admin":false},"milestone":null,"comments":41,"created_at":"2016-04-01T22:44:32Z","updated_at":"2016-05-19T19:56:45Z","closed_at":null,"body":"If a chaincode calls `stub.GetState` with a key that does not exist, no error or presence indication is returned. This can lead to crashes if the chaincode was expecting the key to be present and non-empty. Since the empty byte array is valid data this can not be used as a check for the presence of of key. It seems that the \"Go way\" to handle this would be to include a 3rd, 'ok' return value separate from the error return that would be set true if and only if the key were actually found in the database."},"comment":{"url":"https://api.github.com/repos/hyperledger/fabric/issues/comments/220434729","html_url":"https://github.com/hyperledger/fabric/issues/936#issuecomment-220434729","issue_url":"https://api.github.com/repos/hyperledger/fabric/issues/936","id":220434729,"user":{"login":"murali-katipalli-dtcc","id":16924968,"avatar_url":"https://avatars.githubusercontent.com/u/16924968?v=3","gravatar_id":"","url":"https://api.github.com/users/murali-katipalli-dtcc","html_url":"https://github.com/murali-katipalli-dtcc","followers_url":"https://api.github.com/users/murali-katipalli-dtcc/followers","following_url":"https://api.github.com/users/murali-katipalli-dtcc/following{/other_user}","gists_url":"https://api.github.com/users/murali-katipalli-dtcc/gists{/gist_id}","starred_url":"https://api.github.com/users/murali-katipalli-dtcc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/murali-katipalli-dtcc/subscriptions","organizations_url":"https://api.github.com/users/murali-katipalli-dtcc/orgs","repos_url":"https://api.github.com/users/murali-katipalli-dtcc/repos","events_url":"https://api.github.com/users/murali-katipalli-dtcc/events{/privacy}","received_events_url":"https://api.github.com/users/murali-katipalli-dtcc/received_events","type":"User","site_admin":false},"created_at":"2016-05-19T19:56:45Z","updated_at":"2016-05-19T19:56:45Z","body":"@muralisrini  Yes, agree\r\n@manish-sethi Have you implemented writing the empty 1 byte array from the peer side?\r\n\r\nSo from my side or the shim side, I have to interpret the byte array accordingly - empty 1 byte means, key has empty array; nil means key doesn't exist. If key doesn't exist, throw appropriate error message\r\n\r\nIf that sounds correct, I will go ahead with implementation\r\n"}}