Exemplo n.º 1
0
 /**
  * @param int $blockHeight
  * @return \React\Promise\Promise|\React\Promise\PromiseInterface
  */
 public function blockGetChunk($blockHeight)
 {
     return $this->conn->request(self::BLOCK_GET_CHUNK, [$blockHeight]);
 }
Exemplo n.º 2
0
 public function testOnDataWorksWithPartialMessages()
 {
     $data = json_encode(["id" => 1, "result" => [1]]) . "\n";
     $half1 = substr($data, 0, 4);
     $half2 = substr($data, 4);
     $loop = new StreamSelectLoop();
     $request = new RequestFactory();
     $connection = new Connection(new Stream(fopen('php://stdin', 'r'), $loop), $request);
     $counter = 0;
     $connection->on('message', function () use(&$counter) {
         $counter++;
     });
     $connection->onData($half1);
     $connection->onData($half2);
     $this->assertEquals(1, $counter);
 }
Exemplo n.º 3
0
 /**
  * @param string $worker_name
  * @param string $job_id
  * @param int $extranonce2
  * @param int $ntime
  * @param int $nonce
  * @return \React\Promise\Promise|\React\Promise\PromiseInterface
  */
 public function submit($worker_name, $job_id, $extranonce2, $ntime, $nonce)
 {
     return $this->conn->request(self::SUBMIT, [$worker_name, $job_id, $extranonce2, $ntime, $nonce]);
 }