LCOV - code coverage report
Current view: top level - lib/src/messages - ethereum_work.dart (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 17 17 100.0 %
Date: 2018-01-19 11:13:13 Functions: 0 0 -

          Line data    Source code
       1             : /*
       2             :  * Package : Ethereum
       3             :  * Author : S. Hamblett <steve.hamblett@linux.com>
       4             :  * Date   : 08/01/2017
       5             :  * Copyright :  S.Hamblett
       6             :  *
       7             :  * A JSON RPC 2.0 client for Ethereum
       8             :  */
       9             : 
      10             : part of ethereum;
      11             : 
      12             : /// An ethereum work message.
      13             : /// All elements of the work message must be present.
      14             : class EthereumWork {
      15           1 :   EthereumWork();
      16             : 
      17           2 :   EthereumWork.fromList(List result) {
      18           2 :     construct(result);
      19             :   }
      20             : 
      21             :   /// Current block header pow-hash
      22             :   BigInteger _powHash;
      23             : 
      24           2 :   BigInteger get powHash => _powHash;
      25             : 
      26             :   /// Seed hash used for the DAG.
      27             :   BigInteger _seedHash;
      28             : 
      29           2 :   BigInteger get seedHash => _seedHash;
      30             : 
      31             :   /// The boundary condition ("target"), 2^256 / difficulty.
      32             :   BigInteger _boundaryCondition;
      33             : 
      34           2 :   BigInteger get boundaryCondition => _boundaryCondition;
      35             : 
      36             :   /// Construct from the supplied Map, only check for the keys we need.
      37             :   void construct(List data) {
      38             :     if (data == null) {
      39             :       return;
      40             :     }
      41           4 :     if (data.length != 3) {
      42             :       return;
      43             :     }
      44           6 :     _powHash = new BigInteger(data[0]);
      45           6 :     _seedHash = new BigInteger(data[1]);
      46           6 :     _boundaryCondition = new BigInteger(data[2]);
      47             :   }
      48             : 
      49             :   // To string
      50             :   String toString() {
      51           2 :     final String ret = "Ethereum Work :" +
      52           2 :         "\n" +
      53           4 :         "  Pow Hash : $powHash" +
      54           2 :         "\n" +
      55           4 :         "  Seed Hash : $seedHash" +
      56           2 :         "\n" +
      57           4 :         "  Boundary Condition : $boundaryCondition" +
      58             :         "\n";
      59             : 
      60             :     return ret;
      61             :   }
      62             : }

Generated by: LCOV version 1.12