Cosmetics
This commit is contained in:
parent
1043b77c06
commit
6faae5fcf4
|
@ -1,8 +1,8 @@
|
||||||
#ifndef BITMESSAGE_POW_H
|
#ifndef BITMESSAGE_POW_H
|
||||||
#define BITMESSAGE_POW_H
|
#define BITMESSAGE_POW_H
|
||||||
|
|
||||||
#define MAX_POOL_SIZE 1024
|
static const int MAX_POOL_SIZE = 1024;
|
||||||
#define HASH_SIZE 64
|
static const int HASH_SIZE = 64;
|
||||||
|
|
||||||
int pow(size_t pool_size,
|
int pow(size_t pool_size,
|
||||||
uint64_t target,
|
uint64_t target,
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#include <nan.h>
|
#include <nan.h>
|
||||||
#include "./pow.h"
|
#include "./pow.h"
|
||||||
|
|
||||||
#define MAX_SAFE_INTEGER 9007199254740991
|
|
||||||
|
|
||||||
using node::Buffer;
|
using node::Buffer;
|
||||||
using v8::Handle;
|
using v8::Handle;
|
||||||
using v8::Local;
|
using v8::Local;
|
||||||
|
@ -14,6 +12,8 @@ using v8::Object;
|
||||||
using v8::String;
|
using v8::String;
|
||||||
using v8::Integer;
|
using v8::Integer;
|
||||||
|
|
||||||
|
static const uint64_t MAX_SAFE_INTEGER = 9007199254740991ULL;
|
||||||
|
|
||||||
class PowWorker : public NanAsyncWorker {
|
class PowWorker : public NanAsyncWorker {
|
||||||
public:
|
public:
|
||||||
PowWorker(NanCallback* callback,
|
PowWorker(NanCallback* callback,
|
||||||
|
@ -77,13 +77,12 @@ NAN_METHOD(PowAsync) {
|
||||||
|
|
||||||
size_t pool_size = args[0]->Uint32Value();
|
size_t pool_size = args[0]->Uint32Value();
|
||||||
uint64_t target = args[1]->IntegerValue();
|
uint64_t target = args[1]->IntegerValue();
|
||||||
size_t length = Buffer::Length(args[2]->ToObject());
|
|
||||||
char* buf = Buffer::Data(args[2]->ToObject());
|
char* buf = Buffer::Data(args[2]->ToObject());
|
||||||
if (
|
size_t length = Buffer::Length(args[2]->ToObject());
|
||||||
pool_size < 1 ||
|
if (pool_size < 1 ||
|
||||||
pool_size > MAX_POOL_SIZE ||
|
pool_size > MAX_POOL_SIZE ||
|
||||||
length != HASH_SIZE ||
|
buf == NULL ||
|
||||||
buf == NULL) {
|
length != HASH_SIZE) {
|
||||||
return NanThrowError("Bad input");
|
return NanThrowError("Bad input");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user