make compatible with standard node-cryptonote-pool

forknote_comp
clintar 2015-11-17 23:26:36 -07:00
parent 0ac11dca8b
commit 54f5563ebb
1 changed files with 19 additions and 6 deletions

View File

@ -240,14 +240,27 @@ void address_decode(const Nan::FunctionCallbackInfo<v8::Value>& info) {
account_public_address adr; account_public_address adr;
if (!::serialization::parse_binary(data, adr)) if (!::serialization::parse_binary(data, adr) || !crypto::check_key(adr.m_spend_public_key) || !crypto::check_key(adr.m_view_public_key))
info.GetReturnValue().Set(Nan::Undefined()); {
if(data.length())
if (!crypto::check_key(adr.m_spend_public_key) || !crypto::check_key(adr.m_view_public_key)) {
data = uint64be_to_blob(prefix) + data;
}
else
{
info.GetReturnValue().Set(Nan::Undefined()); info.GetReturnValue().Set(Nan::Undefined());
}
v8::Local<v8::Value> returnValue = Nan::CopyBuffer((char*)data.data(), data.size()).ToLocalChecked();
info.GetReturnValue().Set(
returnValue
);
}
else
{
info.GetReturnValue().Set(Nan::New(static_cast<uint32_t>(prefix))); info.GetReturnValue().Set(Nan::New(static_cast<uint32_t>(prefix)));
} }
}
NAN_MODULE_INIT(init) { NAN_MODULE_INIT(init) {
Nan::Set(target, Nan::New("construct_block_blob").ToLocalChecked(), Nan::GetFunction(Nan::New<FunctionTemplate>(construct_block_blob)).ToLocalChecked()); Nan::Set(target, Nan::New("construct_block_blob").ToLocalChecked(), Nan::GetFunction(Nan::New<FunctionTemplate>(construct_block_blob)).ToLocalChecked());