Browse files

Fixed the expiration on getwork, and also added a default.

  • Loading branch information...
1 parent d98856f commit 921bee7321211b398928834db025924076cd274a @travist committed Mar 10, 2014
Showing with 7 additions and 7 deletions.
  1. +2 −2 lib/src/miner.dart
  2. +4 −4 lib/src/work.dart
  3. +1 −1 pubspec.yaml
View
4 lib/src/miner.dart
@@ -11,7 +11,7 @@ class Miner {
* @param Map work
* The JSON map of the work.
*/
- Miner.fromJSON(Map<String, String> work, {int expires: 0, int nonce: 0}) {
+ Miner.fromJSON(Map<String, String> work, {int expires: 120, int nonce: 0}) {
this.work = new Work.fromJSON(work, nonce: nonce, expires: expires);
}
@@ -24,7 +24,7 @@ class Miner {
* @param int startNonce
* The nonce to start with.
*/
- Miner.fromHeader(Uint32List header, Uint32List target, {int expires: 0, int nonce: 0}) {
+ Miner.fromHeader(Uint32List header, Uint32List target, {int expires: 120, int nonce: 0}) {
this.work = new Work.fromHeader(header, target, nonce: nonce, expires: expires);
}
View
8 lib/src/work.dart
@@ -28,7 +28,7 @@ class Work {
* @param Map<String, String> work
* The JSON representation of a work object.
*/
- Work.fromJSON(Map<String, String> work, {int this.expires: 0, int this.nonce: 0}) {
+ Work.fromJSON(Map<String, String> work, {int this.expires: 120, int this.nonce: 0}) {
sha256 = new doubleSHA256();
golden = false;
created = now();
@@ -41,7 +41,7 @@ class Work {
/**
* Create work from a single data string.
*/
- Work.fromData(String hexData, {int this.expires: 0, int this.nonce: 0}) {
+ Work.fromData(String hexData, {int this.expires: 120, int this.nonce: 0}) {
golden = false;
created = now();
half = hexToList(hexData.substring(0, 128));
@@ -59,7 +59,7 @@ class Work {
* @param int startNonce
* The nonce to start with.
*/
- Work.fromHeader(Uint32List header, Uint32List this.target, {int this.expires: 0, int this.nonce: 0}) {
+ Work.fromHeader(Uint32List header, Uint32List this.target, {int this.expires: 120, int this.nonce: 0}) {
golden = false;
created = now();
@@ -115,7 +115,7 @@ class Work {
// If no expiration, then always return true.
if (expires == 0) {
- return true;
+ return false;
}
// Return if we still have time to mine.
View
2 pubspec.yaml
@@ -1,6 +1,6 @@
name: dartminer
author: Travis Tidwell <travist349@gmail.com>
-version: 0.0.9
+version: 0.0.10
homepage: https://github.com/travist/dartminer
description: A Bitcoin miner with Dart language.
dependencies:

0 comments on commit 921bee7

Please sign in to comment.