{"action":"created","comment":{"url":"https://api.github.com/repos/Tribler/py-ipv8/pulls/comments/180102660","pull_request_review_id":110464495,"id":180102660,"diff_hunk":"@@ -60,6 +59,9 @@ def __init__(self, *args, **kwargs):\n         self.logger.debug(\"The trustchain community started with Public Key: %s\",\n                           self.my_peer.public_key.key_to_bin().encode(\"hex\"))\n         self.broadcast_block = True  # Whether we broadcast a full block after constructing it\n+        self.listeners_map = {}  # Map of block_type -> [callbacks]","path":"ipv8/attestation/trustchain/community.py","position":24,"original_position":24,"commit_id":"b338bb16a5ab592f8f31932fdc83e14015082a25","original_commit_id":"b338bb16a5ab592f8f31932fdc83e14015082a25","user":{"login":"qstokkink","id":3630389,"avatar_url":"https://avatars1.githubusercontent.com/u/3630389?v=4","gravatar_id":"","url":"https://api.github.com/users/qstokkink","html_url":"https://github.com/qstokkink","followers_url":"https://api.github.com/users/qstokkink/followers","following_url":"https://api.github.com/users/qstokkink/following{/other_user}","gists_url":"https://api.github.com/users/qstokkink/gists{/gist_id}","starred_url":"https://api.github.com/users/qstokkink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qstokkink/subscriptions","organizations_url":"https://api.github.com/users/qstokkink/orgs","repos_url":"https://api.github.com/users/qstokkink/repos","events_url":"https://api.github.com/users/qstokkink/events{/privacy}","received_events_url":"https://api.github.com/users/qstokkink/received_events","type":"User","site_admin":false},"body":"I don't see how a listener could possibly comprehend what it is called back with, if it does not know the block class it is getting called back with. `self.notify_listeners(block)` gives a block of type `block = self.get_block_class(block_type)`.\r\n\r\nA Listener could be something like:\r\n\r\n```python\r\nclass TrustChainBlock(SomeBlockSuperclass):\r\n    TYPE = 'bandwidth!'\r\n\r\nclass MyBeautifulListener(SomeListenerSuperclass):\r\n    BLOCK_CLASS = TrustChainBlock\r\n\r\n    def should_sign(block):\r\n        return True\r\n```","created_at":"2018-04-09T13:58:02Z","updated_at":"2018-04-09T13:58:02Z","html_url":"https://github.com/Tribler/py-ipv8/pull/96#discussion_r180102660","pull_request_url":"https://api.github.com/repos/Tribler/py-ipv8/pulls/96","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Tribler/py-ipv8/pulls/comments/180102660"},"html":{"href":"https://github.com/Tribler/py-ipv8/pull/96#discussion_r180102660"},"pull_request":{"href":"https://api.github.com/repos/Tribler/py-ipv8/pulls/96"}},"in_reply_to_id":180090961},"pull_request":{"url":"https://api.github.com/repos/Tribler/py-ipv8/pulls/96","id":179989654,"html_url":"https://github.com/Tribler/py-ipv8/pull/96","diff_url":"https://github.com/Tribler/py-ipv8/pull/96.diff","patch_url":"https://github.com/Tribler/py-ipv8/pull/96.patch","issue_url":"https://api.github.com/repos/Tribler/py-ipv8/issues/96","number":96,"state":"open","locked":false,"title":"READY: Refactored TrustChain so it's a single ledger now","user":{"login":"devos50","id":1707075,"avatar_url":"https://avatars3.githubusercontent.com/u/1707075?v=4","gravatar_id":"","url":"https://api.github.com/users/devos50","html_url":"https://github.com/devos50","followers_url":"https://api.github.com/users/devos50/followers","following_url":"https://api.github.com/users/devos50/following{/other_user}","gists_url":"https://api.github.com/users/devos50/gists{/gist_id}","starred_url":"https://api.github.com/users/devos50/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devos50/subscriptions","organizations_url":"https://api.github.com/users/devos50/orgs","repos_url":"https://api.github.com/users/devos50/repos","events_url":"https://api.github.com/users/devos50/events{/privacy}","received_events_url":"https://api.github.com/users/devos50/received_events","type":"User","site_admin":false},"body":"In this PR, I refactored the TrustChain overlay so it's a generic ledger that is reusable across several domains. The most important change is that each transaction now should have a type (i.e. `ask`, `tribler_bandwidth`, `attestation` etc). This transaction type is also stored in the database as a separate column for easy lookups. For instance, this allows us to get all blocks with an `attestation` transaction.","created_at":"2018-04-06T16:01:01Z","updated_at":"2018-04-09T13:58:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e7426c942806ff4789a8c00fc37d7961b935e5c7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Tribler/py-ipv8/pulls/96/commits","review_comments_url":"https://api.github.com/repos/Tribler/py-ipv8/pulls/96/comments","review_comment_url":"https://api.github.com/repos/Tribler/py-ipv8/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Tribler/py-ipv8/issues/96/comments","statuses_url":"https://api.github.com/repos/Tribler/py-ipv8/statuses/b338bb16a5ab592f8f31932fdc83e14015082a25","head":{"label":"devos50:one_chain","ref":"one_chain","sha":"b338bb16a5ab592f8f31932fdc83e14015082a25","user":{"login":"devos50","id":1707075,"avatar_url":"https://avatars3.githubusercontent.com/u/1707075?v=4","gravatar_id":"","url":"https://api.github.com/users/devos50","html_url":"https://github.com/devos50","followers_url":"https://api.github.com/users/devos50/followers","following_url":"https://api.github.com/users/devos50/following{/other_user}","gists_url":"https://api.github.com/users/devos50/gists{/gist_id}","starred_url":"https://api.github.com/users/devos50/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devos50/subscriptions","organizations_url":"https://api.github.com/users/devos50/orgs","repos_url":"https://api.github.com/users/devos50/repos","events_url":"https://api.github.com/users/devos50/events{/privacy}","received_events_url":"https://api.github.com/users/devos50/received_events","type":"User","site_admin":false},"repo":{"id":113299215,"name":"py-ipv8","full_name":"devos50/py-ipv8","owner":{"login":"devos50","id":1707075,"avatar_url":"https://avatars3.githubusercontent.com/u/1707075?v=4","gravatar_id":"","url":"https://api.github.com/users/devos50","html_url":"https://github.com/devos50","followers_url":"https://api.github.com/users/devos50/followers","following_url":"https://api.github.com/users/devos50/following{/other_user}","gists_url":"https://api.github.com/users/devos50/gists{/gist_id}","starred_url":"https://api.github.com/users/devos50/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devos50/subscriptions","organizations_url":"https://api.github.com/users/devos50/orgs","repos_url":"https://api.github.com/users/devos50/repos","events_url":"https://api.github.com/users/devos50/events{/privacy}","received_events_url":"https://api.github.com/users/devos50/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/devos50/py-ipv8","description":"Python implementation of the IPV8 layer","fork":true,"url":"https://api.github.com/repos/devos50/py-ipv8","forks_url":"https://api.github.com/repos/devos50/py-ipv8/forks","keys_url":"https://api.github.com/repos/devos50/py-ipv8/keys{/key_id}","collaborators_url":"https://api.github.com/repos/devos50/py-ipv8/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/devos50/py-ipv8/teams","hooks_url":"https://api.github.com/repos/devos50/py-ipv8/hooks","issue_events_url":"https://api.github.com/repos/devos50/py-ipv8/issues/events{/number}","events_url":"https://api.github.com/repos/devos50/py-ipv8/events","assignees_url":"https://api.github.com/repos/devos50/py-ipv8/assignees{/user}","branches_url":"https://api.github.com/repos/devos50/py-ipv8/branches{/branch}","tags_url":"https://api.github.com/repos/devos50/py-ipv8/tags","blobs_url":"https://api.github.com/repos/devos50/py-ipv8/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/devos50/py-ipv8/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/devos50/py-ipv8/git/refs{/sha}","trees_url":"https://api.github.com/repos/devos50/py-ipv8/git/trees{/sha}","statuses_url":"https://api.github.com/repos/devos50/py-ipv8/statuses/{sha}","languages_url":"https://api.github.com/repos/devos50/py-ipv8/languages","stargazers_url":"https://api.github.com/repos/devos50/py-ipv8/stargazers","contributors_url":"https://api.github.com/repos/devos50/py-ipv8/contributors","subscribers_url":"https://api.github.com/repos/devos50/py-ipv8/subscribers","subscription_url":"https://api.github.com/repos/devos50/py-ipv8/subscription","commits_url":"https://api.github.com/repos/devos50/py-ipv8/commits{/sha}","git_commits_url":"https://api.github.com/repos/devos50/py-ipv8/git/commits{/sha}","comments_url":"https://api.github.com/repos/devos50/py-ipv8/comments{/number}","issue_comment_url":"https://api.github.com/repos/devos50/py-ipv8/issues/comments{/number}","contents_url":"https://api.github.com/repos/devos50/py-ipv8/contents/{+path}","compare_url":"https://api.github.com/repos/devos50/py-ipv8/compare/{base}...{head}","merges_url":"https://api.github.com/repos/devos50/py-ipv8/merges","archive_url":"https://api.github.com/repos/devos50/py-ipv8/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/devos50/py-ipv8/downloads","issues_url":"https://api.github.com/repos/devos50/py-ipv8/issues{/number}","pulls_url":"https://api.github.com/repos/devos50/py-ipv8/pulls{/number}","milestones_url":"https://api.github.com/repos/devos50/py-ipv8/milestones{/number}","notifications_url":"https://api.github.com/repos/devos50/py-ipv8/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/devos50/py-ipv8/labels{/name}","releases_url":"https://api.github.com/repos/devos50/py-ipv8/releases{/id}","deployments_url":"https://api.github.com/repos/devos50/py-ipv8/deployments","created_at":"2017-12-06T09:57:39Z","updated_at":"2017-12-06T09:57:40Z","pushed_at":"2018-04-09T12:15:01Z","git_url":"git://github.com/devos50/py-ipv8.git","ssh_url":"git@github.com:devos50/py-ipv8.git","clone_url":"https://github.com/devos50/py-ipv8.git","svn_url":"https://github.com/devos50/py-ipv8","homepage":null,"size":478,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"add_setup"}},"base":{"label":"Tribler:master","ref":"master","sha":"091d6a6d5b7f635bdaaaaf51128ca1198d58b445","user":{"login":"Tribler","id":2913489,"avatar_url":"https://avatars3.githubusercontent.com/u/2913489?v=4","gravatar_id":"","url":"https://api.github.com/users/Tribler","html_url":"https://github.com/Tribler","followers_url":"https://api.github.com/users/Tribler/followers","following_url":"https://api.github.com/users/Tribler/following{/other_user}","gists_url":"https://api.github.com/users/Tribler/gists{/gist_id}","starred_url":"https://api.github.com/users/Tribler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tribler/subscriptions","organizations_url":"https://api.github.com/users/Tribler/orgs","repos_url":"https://api.github.com/users/Tribler/repos","events_url":"https://api.github.com/users/Tribler/events{/privacy}","received_events_url":"https://api.github.com/users/Tribler/received_events","type":"Organization","site_admin":false},"repo":{"id":95567452,"name":"py-ipv8","full_name":"Tribler/py-ipv8","owner":{"login":"Tribler","id":2913489,"avatar_url":"https://avatars3.githubusercontent.com/u/2913489?v=4","gravatar_id":"","url":"https://api.github.com/users/Tribler","html_url":"https://github.com/Tribler","followers_url":"https://api.github.com/users/Tribler/followers","following_url":"https://api.github.com/users/Tribler/following{/other_user}","gists_url":"https://api.github.com/users/Tribler/gists{/gist_id}","starred_url":"https://api.github.com/users/Tribler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tribler/subscriptions","organizations_url":"https://api.github.com/users/Tribler/orgs","repos_url":"https://api.github.com/users/Tribler/repos","events_url":"https://api.github.com/users/Tribler/events{/privacy}","received_events_url":"https://api.github.com/users/Tribler/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Tribler/py-ipv8","description":"Python implementation of the IPv8 layer","fork":false,"url":"https://api.github.com/repos/Tribler/py-ipv8","forks_url":"https://api.github.com/repos/Tribler/py-ipv8/forks","keys_url":"https://api.github.com/repos/Tribler/py-ipv8/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tribler/py-ipv8/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tribler/py-ipv8/teams","hooks_url":"https://api.github.com/repos/Tribler/py-ipv8/hooks","issue_events_url":"https://api.github.com/repos/Tribler/py-ipv8/issues/events{/number}","events_url":"https://api.github.com/repos/Tribler/py-ipv8/events","assignees_url":"https://api.github.com/repos/Tribler/py-ipv8/assignees{/user}","branches_url":"https://api.github.com/repos/Tribler/py-ipv8/branches{/branch}","tags_url":"https://api.github.com/repos/Tribler/py-ipv8/tags","blobs_url":"https://api.github.com/repos/Tribler/py-ipv8/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tribler/py-ipv8/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tribler/py-ipv8/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tribler/py-ipv8/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tribler/py-ipv8/statuses/{sha}","languages_url":"https://api.github.com/repos/Tribler/py-ipv8/languages","stargazers_url":"https://api.github.com/repos/Tribler/py-ipv8/stargazers","contributors_url":"https://api.github.com/repos/Tribler/py-ipv8/contributors","subscribers_url":"https://api.github.com/repos/Tribler/py-ipv8/subscribers","subscription_url":"https://api.github.com/repos/Tribler/py-ipv8/subscription","commits_url":"https://api.github.com/repos/Tribler/py-ipv8/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tribler/py-ipv8/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tribler/py-ipv8/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tribler/py-ipv8/issues/comments{/number}","contents_url":"https://api.github.com/repos/Tribler/py-ipv8/contents/{+path}","compare_url":"https://api.github.com/repos/Tribler/py-ipv8/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tribler/py-ipv8/merges","archive_url":"https://api.github.com/repos/Tribler/py-ipv8/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tribler/py-ipv8/downloads","issues_url":"https://api.github.com/repos/Tribler/py-ipv8/issues{/number}","pulls_url":"https://api.github.com/repos/Tribler/py-ipv8/pulls{/number}","milestones_url":"https://api.github.com/repos/Tribler/py-ipv8/milestones{/number}","notifications_url":"https://api.github.com/repos/Tribler/py-ipv8/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tribler/py-ipv8/labels{/name}","releases_url":"https://api.github.com/repos/Tribler/py-ipv8/releases{/id}","deployments_url":"https://api.github.com/repos/Tribler/py-ipv8/deployments","created_at":"2017-06-27T14:30:23Z","updated_at":"2018-04-09T11:11:04Z","pushed_at":"2018-04-09T11:11:02Z","git_url":"git://github.com/Tribler/py-ipv8.git","ssh_url":"git@github.com:Tribler/py-ipv8.git","clone_url":"https://github.com/Tribler/py-ipv8.git","svn_url":"https://github.com/Tribler/py-ipv8","homepage":"","size":471,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0"},"forks":7,"open_issues":13,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Tribler/py-ipv8/pulls/96"},"html":{"href":"https://github.com/Tribler/py-ipv8/pull/96"},"issue":{"href":"https://api.github.com/repos/Tribler/py-ipv8/issues/96"},"comments":{"href":"https://api.github.com/repos/Tribler/py-ipv8/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/Tribler/py-ipv8/pulls/96/comments"},"review_comment":{"href":"https://api.github.com/repos/Tribler/py-ipv8/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Tribler/py-ipv8/pulls/96/commits"},"statuses":{"href":"https://api.github.com/repos/Tribler/py-ipv8/statuses/b338bb16a5ab592f8f31932fdc83e14015082a25"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"qstokkink"}}