{"action":"created","comment":{"url":"https://api.github.com/repos/input-output-hk/etc-client/pulls/comments/119659094","pull_request_review_id":41559511,"id":119659094,"diff_hunk":"@@ -194,43 +201,52 @@ class EthService(\n     import io.iohk.ethereum.mining.pow.PowCache._\n \n     val blockNumber = appStateStorage.getBestBlockNumber() + 1\n-    //todo delete stub, this transaction is only for demo this code will be deleted in next iteration\n-    val fakeAddress = 42\n-    val privateKey = BigInt(1, Hex.decode(\"f3202185c84325302d43887e90a2e23e7bc058d0450bb58ef2f7585765d7d48b\"))\n-    val keyPair = keyPairFromPrvKey(privateKey)\n-    val txGasLimit = 21000\n-    val txTransfer = 9000\n-    val transaction = Transaction(\n-      nonce = blockNumber - 1,\n-      gasPrice = 1,\n-      gasLimit = txGasLimit,\n-      receivingAddress = Address(fakeAddress),\n-      value = txTransfer,\n-      payload = ByteString.empty)\n-    val signedTransaction: SignedTransaction = SignedTransaction.sign(transaction, keyPair, None)\n-\n-    val txList = Seq(signedTransaction)\n-    val ommersList = Nil\n-    //todo --------------\n-    val block = blockGenerator.generateBlockForMining(blockNumber, txList, ommersList, Address(fakeAddress))\n-\n-    block match {\n-      case Right(b) =>\n-        Future.successful(Right(GetWorkResponse(\n-          powHeaderHash = ByteString(kec256(BlockHeader.getEncodedWithoutNonce(b.header))),\n-          dagSeed = seedForBlock(b.header.number),\n-          target = ByteString((BigInt(2).pow(256) / b.header.difficulty).toByteArray)\n-        )))\n-      case Left(err) =>\n-        log.error(s\"unable to prepare block because of $err\")\n-        Future.successful(Left(JsonRpcErrors.InternalError))\n-    }\n+\n+    import scala.concurrent.ExecutionContext.Implicits.global\n+\n+    getOmmersFromPool.zip(getTransactionsFromPool).map {\n+      case (ommers, pendingTxs) =>\n+        blockGenerator.generateBlockForMining(blockNumber, pendingTxs.signedTransactions, ommers.headers, miningConfig.coinbase) match {\n+          case Right(b) =>\n+            Right(GetWorkResponse(\n+              powHeaderHash = ByteString(kec256(BlockHeader.getEncodedWithoutNonce(b.header))),\n+              dagSeed = seedForBlock(b.header.number),\n+              target = ByteString((BigInt(2).pow(256) / b.header.difficulty).toByteArray)\n+            ))\n+          case Left(err) =>\n+            log.error(s\"unable to prepare block because of $err\")\n+            Left(JsonRpcErrors.InternalError)\n+        }\n+      }\n+  }\n+\n+  private def getOmmersFromPool = {\n+    import scala.concurrent.ExecutionContext.Implicits.global","path":"src/main/scala/io/iohk/ethereum/jsonrpc/EthService.scala","position":92,"original_position":92,"commit_id":"f4bb8d6ceaeb1f73380a0d44fa309f098199b0bd","original_commit_id":"a42407418e594e03a14ca0d8db5337441c2d8ce1","user":{"login":"adamsmo","id":1716116,"avatar_url":"https://avatars0.githubusercontent.com/u/1716116?v=3","gravatar_id":"","url":"https://api.github.com/users/adamsmo","html_url":"https://github.com/adamsmo","followers_url":"https://api.github.com/users/adamsmo/followers","following_url":"https://api.github.com/users/adamsmo/following{/other_user}","gists_url":"https://api.github.com/users/adamsmo/gists{/gist_id}","starred_url":"https://api.github.com/users/adamsmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamsmo/subscriptions","organizations_url":"https://api.github.com/users/adamsmo/orgs","repos_url":"https://api.github.com/users/adamsmo/repos","events_url":"https://api.github.com/users/adamsmo/events{/privacy}","received_events_url":"https://api.github.com/users/adamsmo/received_events","type":"User","site_admin":false},"body":"yes compilation error, you can check it locally","created_at":"2017-06-01T16:10:59Z","updated_at":"2017-06-01T16:10:59Z","html_url":"https://github.com/input-output-hk/etc-client/pull/193#discussion_r119659094","pull_request_url":"https://api.github.com/repos/input-output-hk/etc-client/pulls/193","_links":{"self":{"href":"https://api.github.com/repos/input-output-hk/etc-client/pulls/comments/119659094"},"html":{"href":"https://github.com/input-output-hk/etc-client/pull/193#discussion_r119659094"},"pull_request":{"href":"https://api.github.com/repos/input-output-hk/etc-client/pulls/193"}}},"pull_request":{"url":"https://api.github.com/repos/input-output-hk/etc-client/pulls/193","id":122449792,"html_url":"https://github.com/input-output-hk/etc-client/pull/193","diff_url":"https://github.com/input-output-hk/etc-client/pull/193.diff","patch_url":"https://github.com/input-output-hk/etc-client/pull/193.patch","issue_url":"https://api.github.com/repos/input-output-hk/etc-client/issues/193","number":193,"state":"open","locked":false,"title":"[EC-180][EC-181] Add ommers and transactions from network to new blocks","user":{"login":"adamsmo","id":1716116,"avatar_url":"https://avatars0.githubusercontent.com/u/1716116?v=3","gravatar_id":"","url":"https://api.github.com/users/adamsmo","html_url":"https://github.com/adamsmo","followers_url":"https://api.github.com/users/adamsmo/followers","following_url":"https://api.github.com/users/adamsmo/following{/other_user}","gists_url":"https://api.github.com/users/adamsmo/gists{/gist_id}","starred_url":"https://api.github.com/users/adamsmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamsmo/subscriptions","organizations_url":"https://api.github.com/users/adamsmo/orgs","repos_url":"https://api.github.com/users/adamsmo/repos","events_url":"https://api.github.com/users/adamsmo/events{/privacy}","received_events_url":"https://api.github.com/users/adamsmo/received_events","type":"User","site_admin":false},"body":"for convenience this PR is for\r\n[EC-180] Use transaction from pool to construct new block for mining\r\n[EC-181] Create ommers pool and use them in block creation\r\n\r\nwhich are the last pieces of functionality for mining new blocks\r\n\r\n~this PR depends on https://github.com/input-output-hk/etc-client/pull/183~","created_at":"2017-05-25T14:20:39Z","updated_at":"2017-06-01T16:10:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7b02e5bcc1b5be494b8bcdd26fd8220db3855e70","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/input-output-hk/etc-client/pulls/193/commits","review_comments_url":"https://api.github.com/repos/input-output-hk/etc-client/pulls/193/comments","review_comment_url":"https://api.github.com/repos/input-output-hk/etc-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/input-output-hk/etc-client/issues/193/comments","statuses_url":"https://api.github.com/repos/input-output-hk/etc-client/statuses/f4bb8d6ceaeb1f73380a0d44fa309f098199b0bd","head":{"label":"input-output-hk:feature/useTransactionPool","ref":"feature/useTransactionPool","sha":"f4bb8d6ceaeb1f73380a0d44fa309f098199b0bd","user":{"login":"input-output-hk","id":12909177,"avatar_url":"https://avatars0.githubusercontent.com/u/12909177?v=3","gravatar_id":"","url":"https://api.github.com/users/input-output-hk","html_url":"https://github.com/input-output-hk","followers_url":"https://api.github.com/users/input-output-hk/followers","following_url":"https://api.github.com/users/input-output-hk/following{/other_user}","gists_url":"https://api.github.com/users/input-output-hk/gists{/gist_id}","starred_url":"https://api.github.com/users/input-output-hk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/input-output-hk/subscriptions","organizations_url":"https://api.github.com/users/input-output-hk/orgs","repos_url":"https://api.github.com/users/input-output-hk/repos","events_url":"https://api.github.com/users/input-output-hk/events{/privacy}","received_events_url":"https://api.github.com/users/input-output-hk/received_events","type":"Organization","site_admin":false},"repo":{"id":76256113,"name":"etc-client","full_name":"input-output-hk/etc-client","owner":{"login":"input-output-hk","id":12909177,"avatar_url":"https://avatars0.githubusercontent.com/u/12909177?v=3","gravatar_id":"","url":"https://api.github.com/users/input-output-hk","html_url":"https://github.com/input-output-hk","followers_url":"https://api.github.com/users/input-output-hk/followers","following_url":"https://api.github.com/users/input-output-hk/following{/other_user}","gists_url":"https://api.github.com/users/input-output-hk/gists{/gist_id}","starred_url":"https://api.github.com/users/input-output-hk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/input-output-hk/subscriptions","organizations_url":"https://api.github.com/users/input-output-hk/orgs","repos_url":"https://api.github.com/users/input-output-hk/repos","events_url":"https://api.github.com/users/input-output-hk/events{/privacy}","received_events_url":"https://api.github.com/users/input-output-hk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/input-output-hk/etc-client","description":"A Scala based client for Ethereum Classic. ","fork":false,"url":"https://api.github.com/repos/input-output-hk/etc-client","forks_url":"https://api.github.com/repos/input-output-hk/etc-client/forks","keys_url":"https://api.github.com/repos/input-output-hk/etc-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/input-output-hk/etc-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/input-output-hk/etc-client/teams","hooks_url":"https://api.github.com/repos/input-output-hk/etc-client/hooks","issue_events_url":"https://api.github.com/repos/input-output-hk/etc-client/issues/events{/number}","events_url":"https://api.github.com/repos/input-output-hk/etc-client/events","assignees_url":"https://api.github.com/repos/input-output-hk/etc-client/assignees{/user}","branches_url":"https://api.github.com/repos/input-output-hk/etc-client/branches{/branch}","tags_url":"https://api.github.com/repos/input-output-hk/etc-client/tags","blobs_url":"https://api.github.com/repos/input-output-hk/etc-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/input-output-hk/etc-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/input-output-hk/etc-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/input-output-hk/etc-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/input-output-hk/etc-client/statuses/{sha}","languages_url":"https://api.github.com/repos/input-output-hk/etc-client/languages","stargazers_url":"https://api.github.com/repos/input-output-hk/etc-client/stargazers","contributors_url":"https://api.github.com/repos/input-output-hk/etc-client/contributors","subscribers_url":"https://api.github.com/repos/input-output-hk/etc-client/subscribers","subscription_url":"https://api.github.com/repos/input-output-hk/etc-client/subscription","commits_url":"https://api.github.com/repos/input-output-hk/etc-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/input-output-hk/etc-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/input-output-hk/etc-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/input-output-hk/etc-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/input-output-hk/etc-client/contents/{+path}","compare_url":"https://api.github.com/repos/input-output-hk/etc-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/input-output-hk/etc-client/merges","archive_url":"https://api.github.com/repos/input-output-hk/etc-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/input-output-hk/etc-client/downloads","issues_url":"https://api.github.com/repos/input-output-hk/etc-client/issues{/number}","pulls_url":"https://api.github.com/repos/input-output-hk/etc-client/pulls{/number}","milestones_url":"https://api.github.com/repos/input-output-hk/etc-client/milestones{/number}","notifications_url":"https://api.github.com/repos/input-output-hk/etc-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/input-output-hk/etc-client/labels{/name}","releases_url":"https://api.github.com/repos/input-output-hk/etc-client/releases{/id}","deployments_url":"https://api.github.com/repos/input-output-hk/etc-client/deployments","created_at":"2016-12-12T12:51:31Z","updated_at":"2017-05-18T14:24:28Z","pushed_at":"2017-06-01T14:51:10Z","git_url":"git://github.com/input-output-hk/etc-client.git","ssh_url":"git@github.com:input-output-hk/etc-client.git","clone_url":"https://github.com/input-output-hk/etc-client.git","svn_url":"https://github.com/input-output-hk/etc-client","homepage":null,"size":4489,"stargazers_count":7,"watchers_count":7,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":7,"forks":1,"open_issues":7,"watchers":7,"default_branch":"master"}},"base":{"label":"input-output-hk:phase/4/jsonrpc","ref":"phase/4/jsonrpc","sha":"1ff5a74832942ec41a26b3591f9dd8b99b0246db","user":{"login":"input-output-hk","id":12909177,"avatar_url":"https://avatars0.githubusercontent.com/u/12909177?v=3","gravatar_id":"","url":"https://api.github.com/users/input-output-hk","html_url":"https://github.com/input-output-hk","followers_url":"https://api.github.com/users/input-output-hk/followers","following_url":"https://api.github.com/users/input-output-hk/following{/other_user}","gists_url":"https://api.github.com/users/input-output-hk/gists{/gist_id}","starred_url":"https://api.github.com/users/input-output-hk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/input-output-hk/subscriptions","organizations_url":"https://api.github.com/users/input-output-hk/orgs","repos_url":"https://api.github.com/users/input-output-hk/repos","events_url":"https://api.github.com/users/input-output-hk/events{/privacy}","received_events_url":"https://api.github.com/users/input-output-hk/received_events","type":"Organization","site_admin":false},"repo":{"id":76256113,"name":"etc-client","full_name":"input-output-hk/etc-client","owner":{"login":"input-output-hk","id":12909177,"avatar_url":"https://avatars0.githubusercontent.com/u/12909177?v=3","gravatar_id":"","url":"https://api.github.com/users/input-output-hk","html_url":"https://github.com/input-output-hk","followers_url":"https://api.github.com/users/input-output-hk/followers","following_url":"https://api.github.com/users/input-output-hk/following{/other_user}","gists_url":"https://api.github.com/users/input-output-hk/gists{/gist_id}","starred_url":"https://api.github.com/users/input-output-hk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/input-output-hk/subscriptions","organizations_url":"https://api.github.com/users/input-output-hk/orgs","repos_url":"https://api.github.com/users/input-output-hk/repos","events_url":"https://api.github.com/users/input-output-hk/events{/privacy}","received_events_url":"https://api.github.com/users/input-output-hk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/input-output-hk/etc-client","description":"A Scala based client for Ethereum Classic. ","fork":false,"url":"https://api.github.com/repos/input-output-hk/etc-client","forks_url":"https://api.github.com/repos/input-output-hk/etc-client/forks","keys_url":"https://api.github.com/repos/input-output-hk/etc-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/input-output-hk/etc-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/input-output-hk/etc-client/teams","hooks_url":"https://api.github.com/repos/input-output-hk/etc-client/hooks","issue_events_url":"https://api.github.com/repos/input-output-hk/etc-client/issues/events{/number}","events_url":"https://api.github.com/repos/input-output-hk/etc-client/events","assignees_url":"https://api.github.com/repos/input-output-hk/etc-client/assignees{/user}","branches_url":"https://api.github.com/repos/input-output-hk/etc-client/branches{/branch}","tags_url":"https://api.github.com/repos/input-output-hk/etc-client/tags","blobs_url":"https://api.github.com/repos/input-output-hk/etc-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/input-output-hk/etc-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/input-output-hk/etc-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/input-output-hk/etc-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/input-output-hk/etc-client/statuses/{sha}","languages_url":"https://api.github.com/repos/input-output-hk/etc-client/languages","stargazers_url":"https://api.github.com/repos/input-output-hk/etc-client/stargazers","contributors_url":"https://api.github.com/repos/input-output-hk/etc-client/contributors","subscribers_url":"https://api.github.com/repos/input-output-hk/etc-client/subscribers","subscription_url":"https://api.github.com/repos/input-output-hk/etc-client/subscription","commits_url":"https://api.github.com/repos/input-output-hk/etc-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/input-output-hk/etc-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/input-output-hk/etc-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/input-output-hk/etc-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/input-output-hk/etc-client/contents/{+path}","compare_url":"https://api.github.com/repos/input-output-hk/etc-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/input-output-hk/etc-client/merges","archive_url":"https://api.github.com/repos/input-output-hk/etc-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/input-output-hk/etc-client/downloads","issues_url":"https://api.github.com/repos/input-output-hk/etc-client/issues{/number}","pulls_url":"https://api.github.com/repos/input-output-hk/etc-client/pulls{/number}","milestones_url":"https://api.github.com/repos/input-output-hk/etc-client/milestones{/number}","notifications_url":"https://api.github.com/repos/input-output-hk/etc-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/input-output-hk/etc-client/labels{/name}","releases_url":"https://api.github.com/repos/input-output-hk/etc-client/releases{/id}","deployments_url":"https://api.github.com/repos/input-output-hk/etc-client/deployments","created_at":"2016-12-12T12:51:31Z","updated_at":"2017-05-18T14:24:28Z","pushed_at":"2017-06-01T14:51:10Z","git_url":"git://github.com/input-output-hk/etc-client.git","ssh_url":"git@github.com:input-output-hk/etc-client.git","clone_url":"https://github.com/input-output-hk/etc-client.git","svn_url":"https://github.com/input-output-hk/etc-client","homepage":null,"size":4489,"stargazers_count":7,"watchers_count":7,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":7,"forks":1,"open_issues":7,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/input-output-hk/etc-client/pulls/193"},"html":{"href":"https://github.com/input-output-hk/etc-client/pull/193"},"issue":{"href":"https://api.github.com/repos/input-output-hk/etc-client/issues/193"},"comments":{"href":"https://api.github.com/repos/input-output-hk/etc-client/issues/193/comments"},"review_comments":{"href":"https://api.github.com/repos/input-output-hk/etc-client/pulls/193/comments"},"review_comment":{"href":"https://api.github.com/repos/input-output-hk/etc-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/input-output-hk/etc-client/pulls/193/commits"},"statuses":{"href":"https://api.github.com/repos/input-output-hk/etc-client/statuses/f4bb8d6ceaeb1f73380a0d44fa309f098199b0bd"}}}}
{"actor":{"display_login":"adamsmo"}}