{"action":"opened","number":6,"pull_request":{"url":"https://api.github.com/repos/Colored-Coins/Parser/pulls/6","id":95963438,"html_url":"https://github.com/Colored-Coins/Parser/pull/6","diff_url":"https://github.com/Colored-Coins/Parser/pull/6.diff","patch_url":"https://github.com/Colored-Coins/Parser/pull/6.patch","issue_url":"https://api.github.com/repos/Colored-Coins/Parser/issues/6","number":6,"state":"open","locked":false,"title":"fix: mempool txs not in bitcoind aren't reverted","user":{"login":"oleiba","id":16321515,"avatar_url":"https://avatars.githubusercontent.com/u/16321515?v=3","gravatar_id":"","url":"https://api.github.com/users/oleiba","html_url":"https://github.com/oleiba","followers_url":"https://api.github.com/users/oleiba/followers","following_url":"https://api.github.com/users/oleiba/following{/other_user}","gists_url":"https://api.github.com/users/oleiba/gists{/gist_id}","starred_url":"https://api.github.com/users/oleiba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oleiba/subscriptions","organizations_url":"https://api.github.com/users/oleiba/orgs","repos_url":"https://api.github.com/users/oleiba/repos","events_url":"https://api.github.com/users/oleiba/events{/privacy}","received_events_url":"https://api.github.com/users/oleiba/received_events","type":"User","site_admin":false},"body":"2 fixes here:\r\n1 - `raw_transaction_data.vin[utxo_input_index].doubleSpent` resulted in `TypeError: Cannot set property 'doubleSpentTxid' of undefined`: so in lines 1073 and 1080 there's a safety check before assigning. \r\n2 - `mempool_txs` is the cache of mempool transactions.\r\nWhen coming to xor the differences between the database mempool transactions and the connected bitcoin node mempool transactions, this cache is taken instead of querying the DB.\r\nIn lines 1635-1647, there's a removal of every transaction in `mempool_txs`, the mempool cache, which is a mempool transaction in the DB and not in bitcoind mempool.\r\nThe next revert which goes over `to_revert`, removed only 100 transactions.\r\nNow, the next iteration of xoring, will consider the cache which lacks all the transactions which are actually in DB - which will cause adding *nothing* to the `to_revert` array, in line 1640.\r\nThis causes the parser not to sync with a removal of transactions in bitcoind.\r\nHere's a simplified example:\r\n*1st iteration*\r\nDB mempool txs: [a,b,c]\r\nmemool_txs (cache): [a,b,c]\r\nbitcoind mempool txs: [c]\r\nto_revert: [a,b]\r\nmempool_txs (cache after removal of all DB transactions not in bitcoind): [c]\r\n\r\n*2nd iteration*\r\nonly a was reverted since only a part of the transactions is reverted (`n_batch` line 1460).\r\nDB mempool txs: [b,c]\r\nmempool_txs (cache): [c]\r\nbitcoind mempool txs: [c]\r\nto_revert: []\r\n\r\n... so eventually b is left in DB without getting reverted.\r\nThe change in line 1460-1464 guarantees to revert all DB mempool transactions which are not in bitcoind mempool.\r\n\r\n\r\n\r\n\r\n\r\n\r\n","created_at":"2016-11-30T20:04:24Z","updated_at":"2016-11-30T20:04:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Colored-Coins/Parser/pulls/6/commits","review_comments_url":"https://api.github.com/repos/Colored-Coins/Parser/pulls/6/comments","review_comment_url":"https://api.github.com/repos/Colored-Coins/Parser/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Colored-Coins/Parser/issues/6/comments","statuses_url":"https://api.github.com/repos/Colored-Coins/Parser/statuses/09700f4f37c0eb4a09f937a7a2996fd12dd5bf5e","head":{"label":"Colored-Coins:sync_mempool","ref":"sync_mempool","sha":"09700f4f37c0eb4a09f937a7a2996fd12dd5bf5e","user":{"login":"Colored-Coins","id":12785396,"avatar_url":"https://avatars.githubusercontent.com/u/12785396?v=3","gravatar_id":"","url":"https://api.github.com/users/Colored-Coins","html_url":"https://github.com/Colored-Coins","followers_url":"https://api.github.com/users/Colored-Coins/followers","following_url":"https://api.github.com/users/Colored-Coins/following{/other_user}","gists_url":"https://api.github.com/users/Colored-Coins/gists{/gist_id}","starred_url":"https://api.github.com/users/Colored-Coins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Colored-Coins/subscriptions","organizations_url":"https://api.github.com/users/Colored-Coins/orgs","repos_url":"https://api.github.com/users/Colored-Coins/repos","events_url":"https://api.github.com/users/Colored-Coins/events{/privacy}","received_events_url":"https://api.github.com/users/Colored-Coins/received_events","type":"Organization","site_admin":false},"repo":{"id":41498095,"name":"Parser","full_name":"Colored-Coins/Parser","owner":{"login":"Colored-Coins","id":12785396,"avatar_url":"https://avatars.githubusercontent.com/u/12785396?v=3","gravatar_id":"","url":"https://api.github.com/users/Colored-Coins","html_url":"https://github.com/Colored-Coins","followers_url":"https://api.github.com/users/Colored-Coins/followers","following_url":"https://api.github.com/users/Colored-Coins/following{/other_user}","gists_url":"https://api.github.com/users/Colored-Coins/gists{/gist_id}","starred_url":"https://api.github.com/users/Colored-Coins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Colored-Coins/subscriptions","organizations_url":"https://api.github.com/users/Colored-Coins/orgs","repos_url":"https://api.github.com/users/Colored-Coins/repos","events_url":"https://api.github.com/users/Colored-Coins/events{/privacy}","received_events_url":"https://api.github.com/users/Colored-Coins/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Colored-Coins/Parser","description":null,"fork":false,"url":"https://api.github.com/repos/Colored-Coins/Parser","forks_url":"https://api.github.com/repos/Colored-Coins/Parser/forks","keys_url":"https://api.github.com/repos/Colored-Coins/Parser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Colored-Coins/Parser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Colored-Coins/Parser/teams","hooks_url":"https://api.github.com/repos/Colored-Coins/Parser/hooks","issue_events_url":"https://api.github.com/repos/Colored-Coins/Parser/issues/events{/number}","events_url":"https://api.github.com/repos/Colored-Coins/Parser/events","assignees_url":"https://api.github.com/repos/Colored-Coins/Parser/assignees{/user}","branches_url":"https://api.github.com/repos/Colored-Coins/Parser/branches{/branch}","tags_url":"https://api.github.com/repos/Colored-Coins/Parser/tags","blobs_url":"https://api.github.com/repos/Colored-Coins/Parser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Colored-Coins/Parser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Colored-Coins/Parser/git/refs{/sha}","trees_url":"https://api.github.com/repos/Colored-Coins/Parser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Colored-Coins/Parser/statuses/{sha}","languages_url":"https://api.github.com/repos/Colored-Coins/Parser/languages","stargazers_url":"https://api.github.com/repos/Colored-Coins/Parser/stargazers","contributors_url":"https://api.github.com/repos/Colored-Coins/Parser/contributors","subscribers_url":"https://api.github.com/repos/Colored-Coins/Parser/subscribers","subscription_url":"https://api.github.com/repos/Colored-Coins/Parser/subscription","commits_url":"https://api.github.com/repos/Colored-Coins/Parser/commits{/sha}","git_commits_url":"https://api.github.com/repos/Colored-Coins/Parser/git/commits{/sha}","comments_url":"https://api.github.com/repos/Colored-Coins/Parser/comments{/number}","issue_comment_url":"https://api.github.com/repos/Colored-Coins/Parser/issues/comments{/number}","contents_url":"https://api.github.com/repos/Colored-Coins/Parser/contents/{+path}","compare_url":"https://api.github.com/repos/Colored-Coins/Parser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Colored-Coins/Parser/merges","archive_url":"https://api.github.com/repos/Colored-Coins/Parser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Colored-Coins/Parser/downloads","issues_url":"https://api.github.com/repos/Colored-Coins/Parser/issues{/number}","pulls_url":"https://api.github.com/repos/Colored-Coins/Parser/pulls{/number}","milestones_url":"https://api.github.com/repos/Colored-Coins/Parser/milestones{/number}","notifications_url":"https://api.github.com/repos/Colored-Coins/Parser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Colored-Coins/Parser/labels{/name}","releases_url":"https://api.github.com/repos/Colored-Coins/Parser/releases{/id}","deployments_url":"https://api.github.com/repos/Colored-Coins/Parser/deployments","created_at":"2015-08-27T16:23:40Z","updated_at":"2016-01-11T10:20:43Z","pushed_at":"2016-11-30T20:00:15Z","git_url":"git://github.com/Colored-Coins/Parser.git","ssh_url":"git@github.com:Colored-Coins/Parser.git","clone_url":"https://github.com/Colored-Coins/Parser.git","svn_url":"https://github.com/Colored-Coins/Parser","homepage":null,"size":313,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Colored-Coins:master","ref":"master","sha":"d0bc436490e2cb371c7042e8833fbcc87c4568ca","user":{"login":"Colored-Coins","id":12785396,"avatar_url":"https://avatars.githubusercontent.com/u/12785396?v=3","gravatar_id":"","url":"https://api.github.com/users/Colored-Coins","html_url":"https://github.com/Colored-Coins","followers_url":"https://api.github.com/users/Colored-Coins/followers","following_url":"https://api.github.com/users/Colored-Coins/following{/other_user}","gists_url":"https://api.github.com/users/Colored-Coins/gists{/gist_id}","starred_url":"https://api.github.com/users/Colored-Coins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Colored-Coins/subscriptions","organizations_url":"https://api.github.com/users/Colored-Coins/orgs","repos_url":"https://api.github.com/users/Colored-Coins/repos","events_url":"https://api.github.com/users/Colored-Coins/events{/privacy}","received_events_url":"https://api.github.com/users/Colored-Coins/received_events","type":"Organization","site_admin":false},"repo":{"id":41498095,"name":"Parser","full_name":"Colored-Coins/Parser","owner":{"login":"Colored-Coins","id":12785396,"avatar_url":"https://avatars.githubusercontent.com/u/12785396?v=3","gravatar_id":"","url":"https://api.github.com/users/Colored-Coins","html_url":"https://github.com/Colored-Coins","followers_url":"https://api.github.com/users/Colored-Coins/followers","following_url":"https://api.github.com/users/Colored-Coins/following{/other_user}","gists_url":"https://api.github.com/users/Colored-Coins/gists{/gist_id}","starred_url":"https://api.github.com/users/Colored-Coins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Colored-Coins/subscriptions","organizations_url":"https://api.github.com/users/Colored-Coins/orgs","repos_url":"https://api.github.com/users/Colored-Coins/repos","events_url":"https://api.github.com/users/Colored-Coins/events{/privacy}","received_events_url":"https://api.github.com/users/Colored-Coins/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Colored-Coins/Parser","description":null,"fork":false,"url":"https://api.github.com/repos/Colored-Coins/Parser","forks_url":"https://api.github.com/repos/Colored-Coins/Parser/forks","keys_url":"https://api.github.com/repos/Colored-Coins/Parser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Colored-Coins/Parser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Colored-Coins/Parser/teams","hooks_url":"https://api.github.com/repos/Colored-Coins/Parser/hooks","issue_events_url":"https://api.github.com/repos/Colored-Coins/Parser/issues/events{/number}","events_url":"https://api.github.com/repos/Colored-Coins/Parser/events","assignees_url":"https://api.github.com/repos/Colored-Coins/Parser/assignees{/user}","branches_url":"https://api.github.com/repos/Colored-Coins/Parser/branches{/branch}","tags_url":"https://api.github.com/repos/Colored-Coins/Parser/tags","blobs_url":"https://api.github.com/repos/Colored-Coins/Parser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Colored-Coins/Parser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Colored-Coins/Parser/git/refs{/sha}","trees_url":"https://api.github.com/repos/Colored-Coins/Parser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Colored-Coins/Parser/statuses/{sha}","languages_url":"https://api.github.com/repos/Colored-Coins/Parser/languages","stargazers_url":"https://api.github.com/repos/Colored-Coins/Parser/stargazers","contributors_url":"https://api.github.com/repos/Colored-Coins/Parser/contributors","subscribers_url":"https://api.github.com/repos/Colored-Coins/Parser/subscribers","subscription_url":"https://api.github.com/repos/Colored-Coins/Parser/subscription","commits_url":"https://api.github.com/repos/Colored-Coins/Parser/commits{/sha}","git_commits_url":"https://api.github.com/repos/Colored-Coins/Parser/git/commits{/sha}","comments_url":"https://api.github.com/repos/Colored-Coins/Parser/comments{/number}","issue_comment_url":"https://api.github.com/repos/Colored-Coins/Parser/issues/comments{/number}","contents_url":"https://api.github.com/repos/Colored-Coins/Parser/contents/{+path}","compare_url":"https://api.github.com/repos/Colored-Coins/Parser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Colored-Coins/Parser/merges","archive_url":"https://api.github.com/repos/Colored-Coins/Parser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Colored-Coins/Parser/downloads","issues_url":"https://api.github.com/repos/Colored-Coins/Parser/issues{/number}","pulls_url":"https://api.github.com/repos/Colored-Coins/Parser/pulls{/number}","milestones_url":"https://api.github.com/repos/Colored-Coins/Parser/milestones{/number}","notifications_url":"https://api.github.com/repos/Colored-Coins/Parser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Colored-Coins/Parser/labels{/name}","releases_url":"https://api.github.com/repos/Colored-Coins/Parser/releases{/id}","deployments_url":"https://api.github.com/repos/Colored-Coins/Parser/deployments","created_at":"2015-08-27T16:23:40Z","updated_at":"2016-01-11T10:20:43Z","pushed_at":"2016-11-30T20:00:15Z","git_url":"git://github.com/Colored-Coins/Parser.git","ssh_url":"git@github.com:Colored-Coins/Parser.git","clone_url":"https://github.com/Colored-Coins/Parser.git","svn_url":"https://github.com/Colored-Coins/Parser","homepage":null,"size":313,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Colored-Coins/Parser/pulls/6"},"html":{"href":"https://github.com/Colored-Coins/Parser/pull/6"},"issue":{"href":"https://api.github.com/repos/Colored-Coins/Parser/issues/6"},"comments":{"href":"https://api.github.com/repos/Colored-Coins/Parser/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/Colored-Coins/Parser/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/Colored-Coins/Parser/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Colored-Coins/Parser/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/Colored-Coins/Parser/statuses/09700f4f37c0eb4a09f937a7a2996fd12dd5bf5e"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":18,"deletions":12,"changed_files":1}}
{"actor":{"display_login":"oleiba"}}