{"action":"created","issue":{"url":"https://api.github.com/repos/bitpay/copay/issues/2308","labels_url":"https://api.github.com/repos/bitpay/copay/issues/2308/labels{/name}","comments_url":"https://api.github.com/repos/bitpay/copay/issues/2308/comments","events_url":"https://api.github.com/repos/bitpay/copay/issues/2308/events","html_url":"https://github.com/bitpay/copay/issues/2308","id":54235161,"number":2308,"title":"Crash on ADDRESSBOOK message handling after sending a transaction","user":{"login":"mxmauro","id":1683070,"avatar_url":"https://avatars.githubusercontent.com/u/1683070?v=3","gravatar_id":"","url":"https://api.github.com/users/mxmauro","html_url":"https://github.com/mxmauro","followers_url":"https://api.github.com/users/mxmauro/followers","following_url":"https://api.github.com/users/mxmauro/following{/other_user}","gists_url":"https://api.github.com/users/mxmauro/gists{/gist_id}","starred_url":"https://api.github.com/users/mxmauro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mxmauro/subscriptions","organizations_url":"https://api.github.com/users/mxmauro/orgs","repos_url":"https://api.github.com/users/mxmauro/repos","events_url":"https://api.github.com/users/mxmauro/events{/privacy}","received_events_url":"https://api.github.com/users/mxmauro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-13T19:18:46Z","updated_at":"2015-01-15T13:21:47Z","closed_at":null,"body":"Hi,\r\n\r\nAfter sending a payment, a copayer's instance generated an exception on BitCore's Address validation (Actually on VersionedData's constructor)\r\n\r\nExamining the stacktrace and code I believe the problem is located on **js/models/Wallet.js** @ *line 661*\r\n\r\n    if (key && !self.addressBook[key] && Address.validate(key)) {\r\n \r\nshould say:\r\n\r\n    if (key && !self.addressBook[key] && Address.validate(value)) {\r\n\r\nIn our test, the *key* variable had a value of 1.\r\n\r\nRegards,\r\nMauro."},"comment":{"url":"https://api.github.com/repos/bitpay/copay/issues/comments/70084366","html_url":"https://github.com/bitpay/copay/issues/2308#issuecomment-70084366","issue_url":"https://api.github.com/repos/bitpay/copay/issues/2308","id":70084366,"user":{"login":"matiaspando","id":2073486,"avatar_url":"https://avatars.githubusercontent.com/u/2073486?v=3","gravatar_id":"","url":"https://api.github.com/users/matiaspando","html_url":"https://github.com/matiaspando","followers_url":"https://api.github.com/users/matiaspando/followers","following_url":"https://api.github.com/users/matiaspando/following{/other_user}","gists_url":"https://api.github.com/users/matiaspando/gists{/gist_id}","starred_url":"https://api.github.com/users/matiaspando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matiaspando/subscriptions","organizations_url":"https://api.github.com/users/matiaspando/orgs","repos_url":"https://api.github.com/users/matiaspando/repos","events_url":"https://api.github.com/users/matiaspando/events{/privacy}","received_events_url":"https://api.github.com/users/matiaspando/received_events","type":"User","site_admin":false},"created_at":"2015-01-15T13:21:47Z","updated_at":"2015-01-15T13:21:47Z","body":"Hi Mauro:\r\n         Thanks for reporting an issue. Actually the line\r\nif (key && !self.addressBook[key] && Address.validate(key)) {\r\n\r\nis correct because the 'key' is the bitcoin address and the 'value' is an object with this structure\r\n {\r\n    hidden: boolean,\r\n    createdTs: timeStamp,\r\n    copayerId: string,\r\n    label: string,\r\n  };\r\n\r\nCheck the method setAddressBook on line 2615\r\n\r\n "}}