From 5b47025afe6855ccc3bba8c1d7936ccc0df68db7 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Thu, 14 Dec 2017 22:20:37 +0800 Subject: [PATCH] eth_getWork --- src/Eth.php | 1 + test/unit/EthTest.php | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/Eth.php b/src/Eth.php index 9dd182d..2f59db9 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -304,6 +304,7 @@ class Eth ] ] ], + 'eth_getWork' => [] ]; /** diff --git a/test/unit/EthTest.php b/test/unit/EthTest.php index f5b0639..2f12ba8 100644 --- a/test/unit/EthTest.php +++ b/test/unit/EthTest.php @@ -1025,6 +1025,32 @@ class EthTest extends TestCase }); } + /** + * testGetWork + * + * @return void + */ + public function testGetWork() + { + $eth = $this->eth; + + $eth->getWork(function ($err, $work) { + if ($err !== null) { + return $this->fail($err->getMessage()); + } + if (isset($work->result)) { + $this->assertTrue(is_array($work->result)); + } else { + if (isset($work->error)) { + // we cannot get work if coinbase isnot set. + $this->assertTrue(is_string($work->error->message)); + } else { + $this->assertTrue(true); + } + } + }); + } + /** * testUnallowedMethod *