Cosmetics

This commit is contained in:
Kagami Hiiragi 2015-01-15 00:37:23 +03:00
parent 1043b77c06
commit 6faae5fcf4
2 changed files with 8 additions and 9 deletions

View File

@ -1,8 +1,8 @@
#ifndef BITMESSAGE_POW_H
#define BITMESSAGE_POW_H
#define MAX_POOL_SIZE 1024
#define HASH_SIZE 64
static const int MAX_POOL_SIZE = 1024;
static const int HASH_SIZE = 64;
int pow(size_t pool_size,
uint64_t target,

View File

@ -2,8 +2,6 @@
#include <nan.h>
#include "./pow.h"
#define MAX_SAFE_INTEGER 9007199254740991
using node::Buffer;
using v8::Handle;
using v8::Local;
@ -14,6 +12,8 @@ using v8::Object;
using v8::String;
using v8::Integer;
static const uint64_t MAX_SAFE_INTEGER = 9007199254740991ULL;
class PowWorker : public NanAsyncWorker {
public:
PowWorker(NanCallback* callback,
@ -77,13 +77,12 @@ NAN_METHOD(PowAsync) {
size_t pool_size = args[0]->Uint32Value();
uint64_t target = args[1]->IntegerValue();
size_t length = Buffer::Length(args[2]->ToObject());
char* buf = Buffer::Data(args[2]->ToObject());
if (
pool_size < 1 ||
size_t length = Buffer::Length(args[2]->ToObject());
if (pool_size < 1 ||
pool_size > MAX_POOL_SIZE ||
length != HASH_SIZE ||
buf == NULL) {
buf == NULL ||
length != HASH_SIZE) {
return NanThrowError("Bad input");
}