diff --git a/src/main.cc b/src/main.cc index ce206d0e..1c3ad81f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -139,9 +139,11 @@ void get_block_id(const Nan::FunctionCallbackInfo& info) { blobdata input = std::string(Buffer::Data(target), Buffer::Length(target)); blobdata output = ""; + int errorCode = 0; + block b = AUTO_VAL_INIT(b); - if (!parse_and_validate_block_from_blob(input, b, b.major_version >= mergedMiningBlockVersion)) - return THROW_ERROR_EXCEPTION("Failed to parse block"); + if (!parse_and_validate_block_from_blob(input, b, b.major_version >= mergedMiningBlockVersion, &errorCode)) + return THROW_ERROR_EXCEPTION("Failed to parse block" + std::to_string(errorCode)); crypto::hash block_id; if (!get_block_hash(b, block_id, mergedMiningBlockVersion)) @@ -178,9 +180,11 @@ void construct_block_blob(const Nan::FunctionCallbackInfo& info) { blobdata block_template_blob = std::string(Buffer::Data(block_template_buf), Buffer::Length(block_template_buf)); blobdata output = ""; + int errorCode = 0; + block b = AUTO_VAL_INIT(b); - if (!parse_and_validate_block_from_blob(block_template_blob, b, b.major_version >= mergedMiningBlockVersion)) - return THROW_ERROR_EXCEPTION("Failed to parse block"); + if (!parse_and_validate_block_from_blob(block_template_blob, b, b.major_version >= mergedMiningBlockVersion, &errorCode)) + return THROW_ERROR_EXCEPTION("Failed to parse block" + std::to_string(errorCode)); b.nonce = nonce; if (b.major_version == mergedMiningBlockVersion) {