fixed compilation errors
This commit is contained in:
parent
026fe2dc3a
commit
afe681412c
3 changed files with 23 additions and 16 deletions
16
binding.gyp
16
binding.gyp
|
|
@ -15,19 +15,19 @@
|
|||
"src/crypto/hash.c",
|
||||
"src/crypto/keccak.c",
|
||||
"src/common/base58.cpp",
|
||||
"contrib/ethereum/libethash/ethash.cpp",
|
||||
"contrib/ethereum/libethash/keccak.c",
|
||||
"contrib/ethereum/libethash/keccakf800.c",
|
||||
"contrib/ethereum/libethash/keccakf800.c",
|
||||
"contrib/ethereum/libethash/progpow.cpp",
|
||||
"contrib/ethereum/libethash/managed.cpp"
|
||||
"src/contrib/ethereum/libethash/ethash.cpp",
|
||||
"src/contrib/ethereum/libethash/keccak.c",
|
||||
"src/contrib/ethereum/libethash/keccakf800.c",
|
||||
"src/contrib/ethereum/libethash/keccakf800.c",
|
||||
"src/contrib/ethereum/libethash/progpow.cpp",
|
||||
"src/contrib/ethereum/libethash/managed.cpp"
|
||||
],
|
||||
"include_dirs": [
|
||||
"src",
|
||||
"src/contrib",
|
||||
"src/contrib/epee/include",
|
||||
"src/contrib/eos_portable_archive",
|
||||
"contrib/ethereum/libethash"
|
||||
"src/contrib",
|
||||
"src/contrib/ethereum/libethash",
|
||||
"<!(node -e \"require('nan')\")"
|
||||
],
|
||||
"link_settings": {
|
||||
|
|
|
|||
|
|
@ -26,8 +26,9 @@
|
|||
|
||||
|
||||
#pragma once
|
||||
|
||||
extern "C" {
|
||||
#include "zlib/zlib.h"
|
||||
//#include "zlib/zlib.h"
|
||||
}
|
||||
|
||||
namespace epee
|
||||
|
|
@ -36,7 +37,7 @@ namespace zlib_helper
|
|||
{
|
||||
inline bool pack(const std::string& target, std::string& result_packed_buff)
|
||||
{
|
||||
result_packed_buff.clear();
|
||||
/*result_packed_buff.clear();
|
||||
|
||||
z_stream zstream = {0};
|
||||
int ret = deflateInit(&zstream, Z_DEFAULT_COMPRESSION);
|
||||
|
|
@ -61,21 +62,24 @@ namespace zlib_helper
|
|||
result_packed_buff.erase(0, 2);
|
||||
}
|
||||
|
||||
deflateEnd(& zstream );
|
||||
deflateEnd(& zstream );*/
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool pack(std::string& target)
|
||||
{
|
||||
/*
|
||||
std::string result_packed_buff;
|
||||
bool r = pack(target, result_packed_buff);
|
||||
if (r)
|
||||
result_packed_buff.swap(target);
|
||||
return r;
|
||||
return r;*/
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool unpack(const std::string& target, std::string& decode_summary_buff)
|
||||
{
|
||||
/*
|
||||
z_stream zstream = {0};
|
||||
int ret = inflateInit(&zstream);//
|
||||
|
||||
|
|
@ -136,7 +140,7 @@ namespace zlib_helper
|
|||
|
||||
inflateEnd(&zstream );
|
||||
|
||||
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -151,3 +155,4 @@ namespace zlib_helper
|
|||
|
||||
};
|
||||
}//namespace epee
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ void address_decode(const Nan::FunctionCallbackInfo<v8::Value>& info) {
|
|||
}
|
||||
|
||||
#define SET_BUFFER_RETURN(x, len) \
|
||||
v8::Isolate* isolate = args.GetIsolate(); \
|
||||
args.GetReturnValue().Set(Buffer::Copy(isolate, x, len).ToLocalChecked());
|
||||
|
||||
/*
|
||||
|
|
@ -159,7 +160,7 @@ void get_pow_hash(const Nan::FunctionCallbackInfo<v8::Value>& args) {
|
|||
|
||||
|
||||
crypto::hash h = currency::get_block_longhash(*height_ptr, *block_header_hash_ptr, *nonce_ptr);
|
||||
SET_BUFFER_RETURN(&h, 32);
|
||||
SET_BUFFER_RETURN((const char*)&h, 32);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -200,7 +201,7 @@ void get_hash_from_block_template_with_extra(const Nan::FunctionCallbackInfo<v8:
|
|||
b.miner_tx.extra.push_back(extra);
|
||||
|
||||
crypto::hash h = currency::get_block_hash(b);
|
||||
SET_BUFFER_RETURN(&h, 32);
|
||||
SET_BUFFER_RETURN((const char*)&h, 32);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -235,7 +236,7 @@ void get_blob_from_block_template(const Nan::FunctionCallbackInfo<v8::Value>& ar
|
|||
|
||||
char* block_template_buffer_ptr = Buffer::Data(block_template_buffer);
|
||||
char* extra_data_ptr = Buffer::Data(extra_data);
|
||||
uint64_t* nonce_ptr = Buffer::Data(nonce);
|
||||
uint64_t* nonce_ptr = (uint64_t* )Buffer::Data(nonce);
|
||||
|
||||
std::string blob(block_template_buffer_ptr, block_template_buffer_len);
|
||||
std::string extra(extra_data_ptr, extra_data_len);
|
||||
|
|
@ -253,6 +254,7 @@ void get_blob_from_block_template(const Nan::FunctionCallbackInfo<v8::Value>& ar
|
|||
std::string result_blob = currency::block_to_blob(b);
|
||||
|
||||
crypto::hash h = currency::get_block_hash(b);
|
||||
|
||||
SET_BUFFER_RETURN(result_blob.data(), result_blob.size());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue