From 0ac3c3c532d015ae192e9ab1e2e733b02e4a882c Mon Sep 17 00:00:00 2001 From: clintar Date: Wed, 23 Mar 2016 16:46:36 -0600 Subject: [PATCH] since BLOCK_MAJOR_VERSION_2 is the same after xmr hardfork, create a different function for fantomcoin for now. --- src/main.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/main.cc b/src/main.cc index 2bf6533..9907c3b 100644 --- a/src/main.cc +++ b/src/main.cc @@ -93,6 +93,33 @@ NAN_METHOD(convert_blob) { blobdata input = std::string(Buffer::Data(target), Buffer::Length(target)); blobdata output = ""; + //convert + block b = AUTO_VAL_INIT(b); + if (!parse_and_validate_block_from_blob(input, b)) + return THROW_ERROR_EXCEPTION("Failed to parse block"); + + if (!get_block_hashing_blob(b, output)) + return THROW_ERROR_EXCEPTION("Failed to create mining block"); + + v8::Local returnValue = Nan::CopyBuffer((char*)output.data(), output.size()).ToLocalChecked(); + info.GetReturnValue().Set( + returnValue + ); +} + +NAN_METHOD(convert_blob_fa) { + + if (info.Length() < 1) + return THROW_ERROR_EXCEPTION("You must provide one argument."); + + Local target = info[0]->ToObject(); + + if (!Buffer::HasInstance(target)) + return THROW_ERROR_EXCEPTION("Argument should be a buffer object."); + + blobdata input = std::string(Buffer::Data(target), Buffer::Length(target)); + blobdata output = ""; + //convert block b = AUTO_VAL_INIT(b); if (!parse_and_validate_block_from_blob(input, b))