Skip to content

Commit d76cd7a

Browse files
committed
Failed tx status if gasUsed == gasLimit fixed
1 parent 80c0720 commit d76cd7a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

service/lib/ethplorer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,12 @@ public function getTransaction($tx){
258258
$cursor = $this->dbs['transactions']->find(array("hash" => $tx));
259259
$result = $cursor->hasNext() ? $cursor->getNext() : false;
260260
if($result){
261+
$receipt = isset($result['receipt']) ? $result['receipt'] : false;
261262
unset($result["_id"]);
262263
$result['gasLimit'] = $result['gas'];
263264
unset($result["gas"]);
264-
$result['gasUsed'] = isset($result['receipt']) ? $result['receipt']['gasUsed'] : 0;
265+
$result['gasUsed'] = $receipt ? $receipt['gasUsed'] : 0;
266+
$success = (($result['gasUsed'] < $result['gasLimit']) || ($receipt && !empty($receipt['logs'])));
265267
$result['success'] = isset($result['receipt']) ? ($result['gasUsed'] < $result['gasLimit']) : true;
266268
}
267269
// evxProfiler::checkpoint('getTransaction FINISH [hash=' . $tx . ']');

0 commit comments

Comments
 (0)