{"action":"created","comment":{"url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls/comments/245121520","pull_request_review_id":189167964,"id":245121520,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0NTEyMTUyMA==","diff_hunk":"@@ -275,6 +280,95 @@ static int _PeerAcceptVerackMessage(BRPeer *peer, const uint8_t *msg, size_t msg\n     return r;\n }\n \n+static int _PeerAcceptAssetMessage(BRPeer *peer, const uint8_t *msg, size_t msgLen) {\n+    size_t off = 0, count = (size_t) BRVarInt(msg, msgLen, &off), sLen = 0;\n+    int r = 1;\n+    \n+    if (off == 0) {\n+        peer_log(peer, \"malformed assets message\");\n+        r = 0;\n+    } else if (msgLen > 16898) {\n+        peer_log(peer, \"dropping assets message, %zu is too many assets, max is 512\", count);\n+    } else {\n+        peer_log(peer, \"got asset with %zu data\", count);\n+        //        nameLen = UInt64GetLE(&msg[off]);\n+        //        off += sizeof(uint64_t);\n+        \n+        BRAsset *asset = NewAsset();\n+\n+        asset->nameLen = count;\n+        \n+        asset->name = malloc(count + 1);\n+        memcpy(asset->name, msg + off, count);\n+        off += count;\n+        *(asset->name + count) = '\\0';\n+        assert(*(asset->name + count) == '\\0');\n+        \n+        asset->amount = (off + sizeof(uint64_t) <= msgLen) ? UInt64GetLE(&msg[off]) : 0;\n+        off += sizeof(uint64_t);\n+        \n+        asset->unit = BRVarInt(&msg[off], (off <= (msgLen) ? (msgLen) - off : 0), &sLen);\n+        off += sLen;\n+        \n+        asset->reissuable = BRVarInt(&msg[off], (off <= (msgLen) ? (msgLen) - off : 0), &sLen);\n+        off += sLen;\n+        \n+        asset->hasIPFS = BRVarInt(&msg[off], (off <= (msgLen) ? (msgLen) - off : 0), &sLen);\n+        off += sLen;\n+        \n+        size_t IPFS_length = (size_t) BRVarInt(&msg[off], (off <= (msgLen) ? (msgLen) - off : 0),\n+                                               &sLen);\n+        off += sLen;\n+        \n+        // Check the end of the script\n+        if (asset->hasIPFS != 0 || IPFS_length != 0) {\n+        \n+        uint8_t IPFS_hash[IPFS_length];\n+        \n+        if (off <= msgLen + IPFS_length) {\n+            memcpy(&IPFS_hash, msg + off, IPFS_length);\n+            off += IPFS_length;\n+            printf(\"\\nIPFS hash: %s\", IPFS_hash);\n+            \n+            EncodeIPFS(asset->IPFSHash, 47, IPFS_hash, IPFS_length);\n+        }\n+        }\n+        \n+        ((BRPeerContext *) peer)->receiveAssetData(peer->assetCallbackInfo, asset);\n+    }\n+    \n+    return r;\n+}\n+\n+static int _PeerAssetNotFoundMessage(BRPeer *peer, const uint8_t *msg, size_t msgLen) {\n+    \n+    size_t off = 0, size = (size_t) BRVarInt(msg, msgLen, &off), nameLen;\n+    int r = 1;\n+    \n+    peer_log(peer, \"got asset msg with %zu data\", size);\n+    \n+    if (size == 0) {\n+        peer_log(peer, \"malformed assets message\");\n+        r = 0;\n+    } else {\n+        //TODO : assign name and len to new asset\n+\n+        nameLen = UInt64GetLE(&msg[off]);\n+        off += sizeof(uint64_t);\n+        \n+        char name[nameLen];","path":"Modules/core/BRPeer.c","position":99,"original_position":99,"commit_id":"9edcd866193285467b104dcd827bcdc67b8083ba","original_commit_id":"9edcd866193285467b104dcd827bcdc67b8083ba","user":{"login":"TronBlack","id":9275874,"node_id":"MDQ6VXNlcjkyNzU4NzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/9275874?v=4","gravatar_id":"","url":"https://api.github.com/users/TronBlack","html_url":"https://github.com/TronBlack","followers_url":"https://api.github.com/users/TronBlack/followers","following_url":"https://api.github.com/users/TronBlack/following{/other_user}","gists_url":"https://api.github.com/users/TronBlack/gists{/gist_id}","starred_url":"https://api.github.com/users/TronBlack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TronBlack/subscriptions","organizations_url":"https://api.github.com/users/TronBlack/orgs","repos_url":"https://api.github.com/users/TronBlack/repos","events_url":"https://api.github.com/users/TronBlack/events{/privacy}","received_events_url":"https://api.github.com/users/TronBlack/received_events","type":"User","site_admin":false},"body":"Should this be nameLen +1\r\n","created_at":"2019-01-03T20:20:17Z","updated_at":"2019-01-03T20:20:17Z","html_url":"https://github.com/RavenProject/ravenwallet-ios/pull/9#discussion_r245121520","pull_request_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls/9","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls/comments/245121520"},"html":{"href":"https://github.com/RavenProject/ravenwallet-ios/pull/9#discussion_r245121520"},"pull_request":{"href":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls/9","id":240795953,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQwNzk1OTUz","html_url":"https://github.com/RavenProject/ravenwallet-ios/pull/9","diff_url":"https://github.com/RavenProject/ravenwallet-ios/pull/9.diff","patch_url":"https://github.com/RavenProject/ravenwallet-ios/pull/9.patch","issue_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/issues/9","number":9,"state":"open","locked":false,"title":"creation / management / burn ...","user":{"login":"ROSHiix","id":37845460,"node_id":"MDQ6VXNlcjM3ODQ1NDYw","avatar_url":"https://avatars1.githubusercontent.com/u/37845460?v=4","gravatar_id":"","url":"https://api.github.com/users/ROSHiix","html_url":"https://github.com/ROSHiix","followers_url":"https://api.github.com/users/ROSHiix/followers","following_url":"https://api.github.com/users/ROSHiix/following{/other_user}","gists_url":"https://api.github.com/users/ROSHiix/gists{/gist_id}","starred_url":"https://api.github.com/users/ROSHiix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ROSHiix/subscriptions","organizations_url":"https://api.github.com/users/ROSHiix/orgs","repos_url":"https://api.github.com/users/ROSHiix/repos","events_url":"https://api.github.com/users/ROSHiix/events{/privacy}","received_events_url":"https://api.github.com/users/ROSHiix/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-24T16:42:32Z","updated_at":"2019-01-03T20:20:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"09cfe73bbe85a1eb6694367f2dd1b34711e6bf88","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls/9/commits","review_comments_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls/9/comments","review_comment_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/issues/9/comments","statuses_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/statuses/9edcd866193285467b104dcd827bcdc67b8083ba","head":{"label":"ROSHiix:Develop","ref":"Develop","sha":"9edcd866193285467b104dcd827bcdc67b8083ba","user":{"login":"ROSHiix","id":37845460,"node_id":"MDQ6VXNlcjM3ODQ1NDYw","avatar_url":"https://avatars1.githubusercontent.com/u/37845460?v=4","gravatar_id":"","url":"https://api.github.com/users/ROSHiix","html_url":"https://github.com/ROSHiix","followers_url":"https://api.github.com/users/ROSHiix/followers","following_url":"https://api.github.com/users/ROSHiix/following{/other_user}","gists_url":"https://api.github.com/users/ROSHiix/gists{/gist_id}","starred_url":"https://api.github.com/users/ROSHiix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ROSHiix/subscriptions","organizations_url":"https://api.github.com/users/ROSHiix/orgs","repos_url":"https://api.github.com/users/ROSHiix/repos","events_url":"https://api.github.com/users/ROSHiix/events{/privacy}","received_events_url":"https://api.github.com/users/ROSHiix/received_events","type":"User","site_admin":false},"repo":{"id":155572490,"node_id":"MDEwOlJlcG9zaXRvcnkxNTU1NzI0OTA=","name":"ravenwallet-ios","full_name":"ROSHiix/ravenwallet-ios","private":false,"owner":{"login":"ROSHiix","id":37845460,"node_id":"MDQ6VXNlcjM3ODQ1NDYw","avatar_url":"https://avatars1.githubusercontent.com/u/37845460?v=4","gravatar_id":"","url":"https://api.github.com/users/ROSHiix","html_url":"https://github.com/ROSHiix","followers_url":"https://api.github.com/users/ROSHiix/followers","following_url":"https://api.github.com/users/ROSHiix/following{/other_user}","gists_url":"https://api.github.com/users/ROSHiix/gists{/gist_id}","starred_url":"https://api.github.com/users/ROSHiix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ROSHiix/subscriptions","organizations_url":"https://api.github.com/users/ROSHiix/orgs","repos_url":"https://api.github.com/users/ROSHiix/repos","events_url":"https://api.github.com/users/ROSHiix/events{/privacy}","received_events_url":"https://api.github.com/users/ROSHiix/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ROSHiix/ravenwallet-ios","description":null,"fork":true,"url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios","forks_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/forks","keys_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/teams","hooks_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/hooks","issue_events_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/issues/events{/number}","events_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/events","assignees_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/assignees{/user}","branches_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/branches{/branch}","tags_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/tags","blobs_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/languages","stargazers_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/stargazers","contributors_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/contributors","subscribers_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/subscribers","subscription_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/subscription","commits_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/contents/{+path}","compare_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/merges","archive_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/downloads","issues_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/issues{/number}","pulls_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/labels{/name}","releases_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/releases{/id}","deployments_url":"https://api.github.com/repos/ROSHiix/ravenwallet-ios/deployments","created_at":"2018-10-31T14:37:20Z","updated_at":"2018-10-31T14:43:06Z","pushed_at":"2019-01-03T17:00:30Z","git_url":"git://github.com/ROSHiix/ravenwallet-ios.git","ssh_url":"git@github.com:ROSHiix/ravenwallet-ios.git","clone_url":"https://github.com/ROSHiix/ravenwallet-ios.git","svn_url":"https://github.com/ROSHiix/ravenwallet-ios","homepage":null,"size":22301,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"RavenProject:Develop","ref":"Develop","sha":"684c26bdae6fcb55e4daf68464d86f5e84c6ddf1","user":{"login":"RavenProject","id":32651605,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyNjUxNjA1","avatar_url":"https://avatars1.githubusercontent.com/u/32651605?v=4","gravatar_id":"","url":"https://api.github.com/users/RavenProject","html_url":"https://github.com/RavenProject","followers_url":"https://api.github.com/users/RavenProject/followers","following_url":"https://api.github.com/users/RavenProject/following{/other_user}","gists_url":"https://api.github.com/users/RavenProject/gists{/gist_id}","starred_url":"https://api.github.com/users/RavenProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RavenProject/subscriptions","organizations_url":"https://api.github.com/users/RavenProject/orgs","repos_url":"https://api.github.com/users/RavenProject/repos","events_url":"https://api.github.com/users/RavenProject/events{/privacy}","received_events_url":"https://api.github.com/users/RavenProject/received_events","type":"Organization","site_admin":false},"repo":{"id":153649338,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM2NDkzMzg=","name":"ravenwallet-ios","full_name":"RavenProject/ravenwallet-ios","private":false,"owner":{"login":"RavenProject","id":32651605,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyNjUxNjA1","avatar_url":"https://avatars1.githubusercontent.com/u/32651605?v=4","gravatar_id":"","url":"https://api.github.com/users/RavenProject","html_url":"https://github.com/RavenProject","followers_url":"https://api.github.com/users/RavenProject/followers","following_url":"https://api.github.com/users/RavenProject/following{/other_user}","gists_url":"https://api.github.com/users/RavenProject/gists{/gist_id}","starred_url":"https://api.github.com/users/RavenProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RavenProject/subscriptions","organizations_url":"https://api.github.com/users/RavenProject/orgs","repos_url":"https://api.github.com/users/RavenProject/repos","events_url":"https://api.github.com/users/RavenProject/events{/privacy}","received_events_url":"https://api.github.com/users/RavenProject/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/RavenProject/ravenwallet-ios","description":null,"fork":false,"url":"https://api.github.com/repos/RavenProject/ravenwallet-ios","forks_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/forks","keys_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/teams","hooks_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/hooks","issue_events_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/issues/events{/number}","events_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/events","assignees_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/assignees{/user}","branches_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/branches{/branch}","tags_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/tags","blobs_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/languages","stargazers_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/stargazers","contributors_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/contributors","subscribers_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/subscribers","subscription_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/subscription","commits_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/contents/{+path}","compare_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/merges","archive_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/downloads","issues_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/issues{/number}","pulls_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/labels{/name}","releases_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/releases{/id}","deployments_url":"https://api.github.com/repos/RavenProject/ravenwallet-ios/deployments","created_at":"2018-10-18T15:48:45Z","updated_at":"2018-12-04T02:14:31Z","pushed_at":"2019-01-03T17:00:31Z","git_url":"git://github.com/RavenProject/ravenwallet-ios.git","ssh_url":"git@github.com:RavenProject/ravenwallet-ios.git","clone_url":"https://github.com/RavenProject/ravenwallet-ios.git","svn_url":"https://github.com/RavenProject/ravenwallet-ios","homepage":null,"size":21743,"stargazers_count":4,"watchers_count":4,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":6,"open_issues":1,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls/9"},"html":{"href":"https://github.com/RavenProject/ravenwallet-ios/pull/9"},"issue":{"href":"https://api.github.com/repos/RavenProject/ravenwallet-ios/issues/9"},"comments":{"href":"https://api.github.com/repos/RavenProject/ravenwallet-ios/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RavenProject/ravenwallet-ios/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/RavenProject/ravenwallet-ios/statuses/9edcd866193285467b104dcd827bcdc67b8083ba"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"TronBlack"}}