{"action":"created","comment":{"url":"https://api.github.com/repos/raiden-network/raiden/pulls/comments/205274548","pull_request_review_id":140514934,"id":205274548,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTI3NDU0OA==","diff_hunk":"@@ -244,46 +229,18 @@ def block_number(self):\n         \"\"\" Return the most recent block. \"\"\"\n         return self.web3.eth.blockNumber\n \n-    def nonce_needs_update(self):\n-        if self.nonce_available_value is None:\n-            return True\n-\n-        now = time.time()\n-\n-        # Python's 2.7 time is not monotonic and it's affected by clock resets,\n-        # force an update.\n-        if self.nonce_last_update > now:\n-            return True\n-\n-        return now - self.nonce_last_update > self.nonce_update_interval\n-\n-    def nonce_update_from_node(self):\n-        nonce = -2\n-        nonce_available_value = self.nonce_available_value or -1\n-\n-        # Wait until all tx are registered as pending\n-        while nonce < nonce_available_value:\n-            pending_transactions = self.web3.eth.getTransactionCount(\n-                to_checksum_address(self.sender),\n-            )\n-            nonce = pending_transactions + self.nonce_offset\n-\n-            log.debug(\n-                'updated nonce from server',\n-                server=nonce,\n-                local=nonce_available_value,\n-            )\n-\n-        self.nonce_last_update = time.time()\n-        self.nonce_available_value = nonce\n+    @cachedmethod(attrgetter('_nonce_cache'))\n+    def _node_nonce_it(self) -> Iterable[int]:\n+        pending_transactions = self.web3.eth.getTransactionCount(","path":"raiden/network/rpc/client.py","position":null,"original_position":113,"commit_id":"08b20acfa0c493703292f477852009a39174a755","original_commit_id":"3965773a9e2c19fa6ff7dc0660e5ac19480a010e","user":{"login":"LefterisJP","id":1658405,"node_id":"MDQ6VXNlcjE2NTg0MDU=","avatar_url":"https://avatars1.githubusercontent.com/u/1658405?v=4","gravatar_id":"","url":"https://api.github.com/users/LefterisJP","html_url":"https://github.com/LefterisJP","followers_url":"https://api.github.com/users/LefterisJP/followers","following_url":"https://api.github.com/users/LefterisJP/following{/other_user}","gists_url":"https://api.github.com/users/LefterisJP/gists{/gist_id}","starred_url":"https://api.github.com/users/LefterisJP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LefterisJP/subscriptions","organizations_url":"https://api.github.com/users/LefterisJP/orgs","repos_url":"https://api.github.com/users/LefterisJP/repos","events_url":"https://api.github.com/users/LefterisJP/events{/privacy}","received_events_url":"https://api.github.com/users/LefterisJP/received_events","type":"User","site_admin":false},"body":"Still `pending_transactions` give the wrong idea. The RPC call used by all DAPPS and defined in the [JSON RPC Spec](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount) gives the number of the transactions sent from this account.\r\n\r\nPlease just use `transaction_count` as it encompasses both meanings (both pending and already completed).","created_at":"2018-07-25T21:55:01Z","updated_at":"2018-07-25T21:55:02Z","html_url":"https://github.com/raiden-network/raiden/pull/1936#discussion_r205274548","pull_request_url":"https://api.github.com/repos/raiden-network/raiden/pulls/1936","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/raiden-network/raiden/pulls/comments/205274548"},"html":{"href":"https://github.com/raiden-network/raiden/pull/1936#discussion_r205274548"},"pull_request":{"href":"https://api.github.com/repos/raiden-network/raiden/pulls/1936"}},"in_reply_to_id":205267880},"pull_request":{"url":"https://api.github.com/repos/raiden-network/raiden/pulls/1936","id":203553096,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzNTUzMDk2","html_url":"https://github.com/raiden-network/raiden/pull/1936","diff_url":"https://github.com/raiden-network/raiden/pull/1936.diff","patch_url":"https://github.com/raiden-network/raiden/pull/1936.patch","issue_url":"https://api.github.com/repos/raiden-network/raiden/issues/1936","number":1936,"state":"open","locked":false,"title":"Fix an issue with mismatching nonce values by proper use of cachetools","user":{"login":"andrevmatos","id":587021,"node_id":"MDQ6VXNlcjU4NzAyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/587021?v=4","gravatar_id":"","url":"https://api.github.com/users/andrevmatos","html_url":"https://github.com/andrevmatos","followers_url":"https://api.github.com/users/andrevmatos/followers","following_url":"https://api.github.com/users/andrevmatos/following{/other_user}","gists_url":"https://api.github.com/users/andrevmatos/gists{/gist_id}","starred_url":"https://api.github.com/users/andrevmatos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrevmatos/subscriptions","organizations_url":"https://api.github.com/users/andrevmatos/orgs","repos_url":"https://api.github.com/users/andrevmatos/repos","events_url":"https://api.github.com/users/andrevmatos/events{/privacy}","received_events_url":"https://api.github.com/users/andrevmatos/received_events","type":"User","site_admin":false},"body":"`cachedmethod` is the right tool here instead of wrapping the methods by hand.\r\nIt works better and in a more straightforward way to update the `nonce` and cache it by the expected time.\r\nIt solved an issue I was having when trying to submit some deposits where the nonce got desynched with the node and couldn't get in sync again with the current code.","created_at":"2018-07-24T14:46:34Z","updated_at":"2018-07-25T21:55:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"70e60d1b844620170e33dadcb33cde235e2fa0ea","assignee":null,"assignees":[],"requested_reviewers":[{"login":"hackaugusto","id":310139,"node_id":"MDQ6VXNlcjMxMDEzOQ==","avatar_url":"https://avatars0.githubusercontent.com/u/310139?v=4","gravatar_id":"","url":"https://api.github.com/users/hackaugusto","html_url":"https://github.com/hackaugusto","followers_url":"https://api.github.com/users/hackaugusto/followers","following_url":"https://api.github.com/users/hackaugusto/following{/other_user}","gists_url":"https://api.github.com/users/hackaugusto/gists{/gist_id}","starred_url":"https://api.github.com/users/hackaugusto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hackaugusto/subscriptions","organizations_url":"https://api.github.com/users/hackaugusto/orgs","repos_url":"https://api.github.com/users/hackaugusto/repos","events_url":"https://api.github.com/users/hackaugusto/events{/privacy}","received_events_url":"https://api.github.com/users/hackaugusto/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":456350195,"node_id":"MDU6TGFiZWw0NTYzNTAxOTU=","url":"https://api.github.com/repos/raiden-network/raiden/labels/dev:%20Please%20Review","name":"dev: Please Review","color":"006b75","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/raiden-network/raiden/pulls/1936/commits","review_comments_url":"https://api.github.com/repos/raiden-network/raiden/pulls/1936/comments","review_comment_url":"https://api.github.com/repos/raiden-network/raiden/pulls/comments{/number}","comments_url":"https://api.github.com/repos/raiden-network/raiden/issues/1936/comments","statuses_url":"https://api.github.com/repos/raiden-network/raiden/statuses/08b20acfa0c493703292f477852009a39174a755","head":{"label":"andrevmatos:fix_nonce_update","ref":"fix_nonce_update","sha":"08b20acfa0c493703292f477852009a39174a755","user":{"login":"andrevmatos","id":587021,"node_id":"MDQ6VXNlcjU4NzAyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/587021?v=4","gravatar_id":"","url":"https://api.github.com/users/andrevmatos","html_url":"https://github.com/andrevmatos","followers_url":"https://api.github.com/users/andrevmatos/followers","following_url":"https://api.github.com/users/andrevmatos/following{/other_user}","gists_url":"https://api.github.com/users/andrevmatos/gists{/gist_id}","starred_url":"https://api.github.com/users/andrevmatos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrevmatos/subscriptions","organizations_url":"https://api.github.com/users/andrevmatos/orgs","repos_url":"https://api.github.com/users/andrevmatos/repos","events_url":"https://api.github.com/users/andrevmatos/events{/privacy}","received_events_url":"https://api.github.com/users/andrevmatos/received_events","type":"User","site_admin":false},"repo":{"id":96226543,"node_id":"MDEwOlJlcG9zaXRvcnk5NjIyNjU0Mw==","name":"raiden","full_name":"andrevmatos/raiden","owner":{"login":"andrevmatos","id":587021,"node_id":"MDQ6VXNlcjU4NzAyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/587021?v=4","gravatar_id":"","url":"https://api.github.com/users/andrevmatos","html_url":"https://github.com/andrevmatos","followers_url":"https://api.github.com/users/andrevmatos/followers","following_url":"https://api.github.com/users/andrevmatos/following{/other_user}","gists_url":"https://api.github.com/users/andrevmatos/gists{/gist_id}","starred_url":"https://api.github.com/users/andrevmatos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrevmatos/subscriptions","organizations_url":"https://api.github.com/users/andrevmatos/orgs","repos_url":"https://api.github.com/users/andrevmatos/repos","events_url":"https://api.github.com/users/andrevmatos/events{/privacy}","received_events_url":"https://api.github.com/users/andrevmatos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andrevmatos/raiden","description":"Raiden Network","fork":true,"url":"https://api.github.com/repos/andrevmatos/raiden","forks_url":"https://api.github.com/repos/andrevmatos/raiden/forks","keys_url":"https://api.github.com/repos/andrevmatos/raiden/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andrevmatos/raiden/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andrevmatos/raiden/teams","hooks_url":"https://api.github.com/repos/andrevmatos/raiden/hooks","issue_events_url":"https://api.github.com/repos/andrevmatos/raiden/issues/events{/number}","events_url":"https://api.github.com/repos/andrevmatos/raiden/events","assignees_url":"https://api.github.com/repos/andrevmatos/raiden/assignees{/user}","branches_url":"https://api.github.com/repos/andrevmatos/raiden/branches{/branch}","tags_url":"https://api.github.com/repos/andrevmatos/raiden/tags","blobs_url":"https://api.github.com/repos/andrevmatos/raiden/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andrevmatos/raiden/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andrevmatos/raiden/git/refs{/sha}","trees_url":"https://api.github.com/repos/andrevmatos/raiden/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andrevmatos/raiden/statuses/{sha}","languages_url":"https://api.github.com/repos/andrevmatos/raiden/languages","stargazers_url":"https://api.github.com/repos/andrevmatos/raiden/stargazers","contributors_url":"https://api.github.com/repos/andrevmatos/raiden/contributors","subscribers_url":"https://api.github.com/repos/andrevmatos/raiden/subscribers","subscription_url":"https://api.github.com/repos/andrevmatos/raiden/subscription","commits_url":"https://api.github.com/repos/andrevmatos/raiden/commits{/sha}","git_commits_url":"https://api.github.com/repos/andrevmatos/raiden/git/commits{/sha}","comments_url":"https://api.github.com/repos/andrevmatos/raiden/comments{/number}","issue_comment_url":"https://api.github.com/repos/andrevmatos/raiden/issues/comments{/number}","contents_url":"https://api.github.com/repos/andrevmatos/raiden/contents/{+path}","compare_url":"https://api.github.com/repos/andrevmatos/raiden/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andrevmatos/raiden/merges","archive_url":"https://api.github.com/repos/andrevmatos/raiden/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andrevmatos/raiden/downloads","issues_url":"https://api.github.com/repos/andrevmatos/raiden/issues{/number}","pulls_url":"https://api.github.com/repos/andrevmatos/raiden/pulls{/number}","milestones_url":"https://api.github.com/repos/andrevmatos/raiden/milestones{/number}","notifications_url":"https://api.github.com/repos/andrevmatos/raiden/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andrevmatos/raiden/labels{/name}","releases_url":"https://api.github.com/repos/andrevmatos/raiden/releases{/id}","deployments_url":"https://api.github.com/repos/andrevmatos/raiden/deployments","created_at":"2017-07-04T14:28:56Z","updated_at":"2018-07-09T09:03:34Z","pushed_at":"2018-07-25T21:49:30Z","git_url":"git://github.com/andrevmatos/raiden.git","ssh_url":"git@github.com:andrevmatos/raiden.git","clone_url":"https://github.com/andrevmatos/raiden.git","svn_url":"https://github.com/andrevmatos/raiden","homepage":null,"size":8027,"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":"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":"raiden-network:master","ref":"master","sha":"c027f80b28839e5848558411250f078ce2b7970c","user":{"login":"raiden-network","id":19666847,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NjY2ODQ3","avatar_url":"https://avatars1.githubusercontent.com/u/19666847?v=4","gravatar_id":"","url":"https://api.github.com/users/raiden-network","html_url":"https://github.com/raiden-network","followers_url":"https://api.github.com/users/raiden-network/followers","following_url":"https://api.github.com/users/raiden-network/following{/other_user}","gists_url":"https://api.github.com/users/raiden-network/gists{/gist_id}","starred_url":"https://api.github.com/users/raiden-network/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raiden-network/subscriptions","organizations_url":"https://api.github.com/users/raiden-network/orgs","repos_url":"https://api.github.com/users/raiden-network/repos","events_url":"https://api.github.com/users/raiden-network/events{/privacy}","received_events_url":"https://api.github.com/users/raiden-network/received_events","type":"Organization","site_admin":false},"repo":{"id":50646767,"node_id":"MDEwOlJlcG9zaXRvcnk1MDY0Njc2Nw==","name":"raiden","full_name":"raiden-network/raiden","owner":{"login":"raiden-network","id":19666847,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NjY2ODQ3","avatar_url":"https://avatars1.githubusercontent.com/u/19666847?v=4","gravatar_id":"","url":"https://api.github.com/users/raiden-network","html_url":"https://github.com/raiden-network","followers_url":"https://api.github.com/users/raiden-network/followers","following_url":"https://api.github.com/users/raiden-network/following{/other_user}","gists_url":"https://api.github.com/users/raiden-network/gists{/gist_id}","starred_url":"https://api.github.com/users/raiden-network/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raiden-network/subscriptions","organizations_url":"https://api.github.com/users/raiden-network/orgs","repos_url":"https://api.github.com/users/raiden-network/repos","events_url":"https://api.github.com/users/raiden-network/events{/privacy}","received_events_url":"https://api.github.com/users/raiden-network/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/raiden-network/raiden","description":"Raiden Network","fork":false,"url":"https://api.github.com/repos/raiden-network/raiden","forks_url":"https://api.github.com/repos/raiden-network/raiden/forks","keys_url":"https://api.github.com/repos/raiden-network/raiden/keys{/key_id}","collaborators_url":"https://api.github.com/repos/raiden-network/raiden/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/raiden-network/raiden/teams","hooks_url":"https://api.github.com/repos/raiden-network/raiden/hooks","issue_events_url":"https://api.github.com/repos/raiden-network/raiden/issues/events{/number}","events_url":"https://api.github.com/repos/raiden-network/raiden/events","assignees_url":"https://api.github.com/repos/raiden-network/raiden/assignees{/user}","branches_url":"https://api.github.com/repos/raiden-network/raiden/branches{/branch}","tags_url":"https://api.github.com/repos/raiden-network/raiden/tags","blobs_url":"https://api.github.com/repos/raiden-network/raiden/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/raiden-network/raiden/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/raiden-network/raiden/git/refs{/sha}","trees_url":"https://api.github.com/repos/raiden-network/raiden/git/trees{/sha}","statuses_url":"https://api.github.com/repos/raiden-network/raiden/statuses/{sha}","languages_url":"https://api.github.com/repos/raiden-network/raiden/languages","stargazers_url":"https://api.github.com/repos/raiden-network/raiden/stargazers","contributors_url":"https://api.github.com/repos/raiden-network/raiden/contributors","subscribers_url":"https://api.github.com/repos/raiden-network/raiden/subscribers","subscription_url":"https://api.github.com/repos/raiden-network/raiden/subscription","commits_url":"https://api.github.com/repos/raiden-network/raiden/commits{/sha}","git_commits_url":"https://api.github.com/repos/raiden-network/raiden/git/commits{/sha}","comments_url":"https://api.github.com/repos/raiden-network/raiden/comments{/number}","issue_comment_url":"https://api.github.com/repos/raiden-network/raiden/issues/comments{/number}","contents_url":"https://api.github.com/repos/raiden-network/raiden/contents/{+path}","compare_url":"https://api.github.com/repos/raiden-network/raiden/compare/{base}...{head}","merges_url":"https://api.github.com/repos/raiden-network/raiden/merges","archive_url":"https://api.github.com/repos/raiden-network/raiden/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/raiden-network/raiden/downloads","issues_url":"https://api.github.com/repos/raiden-network/raiden/issues{/number}","pulls_url":"https://api.github.com/repos/raiden-network/raiden/pulls{/number}","milestones_url":"https://api.github.com/repos/raiden-network/raiden/milestones{/number}","notifications_url":"https://api.github.com/repos/raiden-network/raiden/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/raiden-network/raiden/labels{/name}","releases_url":"https://api.github.com/repos/raiden-network/raiden/releases{/id}","deployments_url":"https://api.github.com/repos/raiden-network/raiden/deployments","created_at":"2016-01-29T07:40:47Z","updated_at":"2018-07-25T15:44:38Z","pushed_at":"2018-07-25T21:49:32Z","git_url":"git://github.com/raiden-network/raiden.git","ssh_url":"git@github.com:raiden-network/raiden.git","clone_url":"https://github.com/raiden-network/raiden.git","svn_url":"https://github.com/raiden-network/raiden","homepage":null,"size":8032,"stargazers_count":1478,"watchers_count":1478,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":297,"mirror_url":null,"archived":false,"open_issues_count":183,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":297,"open_issues":183,"watchers":1478,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/raiden-network/raiden/pulls/1936"},"html":{"href":"https://github.com/raiden-network/raiden/pull/1936"},"issue":{"href":"https://api.github.com/repos/raiden-network/raiden/issues/1936"},"comments":{"href":"https://api.github.com/repos/raiden-network/raiden/issues/1936/comments"},"review_comments":{"href":"https://api.github.com/repos/raiden-network/raiden/pulls/1936/comments"},"review_comment":{"href":"https://api.github.com/repos/raiden-network/raiden/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/raiden-network/raiden/pulls/1936/commits"},"statuses":{"href":"https://api.github.com/repos/raiden-network/raiden/statuses/08b20acfa0c493703292f477852009a39174a755"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"LefterisJP"}}