Skip to content

Commit

Permalink
test errorCode lucasjones#3
Browse files Browse the repository at this point in the history
  • Loading branch information
avtc committed Mar 6, 2018
1 parent 410105d commit 08678b5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ void get_block_id(const Nan::FunctionCallbackInfo<v8::Value>& 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))
Expand Down Expand Up @@ -178,9 +180,11 @@ void construct_block_blob(const Nan::FunctionCallbackInfo<v8::Value>& 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) {
Expand Down

0 comments on commit 08678b5

Please sign in to comment.