Skip to content

Commit

Permalink
test errorCode lucasjones#6
Browse files Browse the repository at this point in the history
  • Loading branch information
avtc committed Mar 6, 2018
1 parent c8d8f2e commit be03ab1
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ NAN_METHOD(convert_blob) {
//convert
block b = AUTO_VAL_INIT(b);
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));
{
char numstr[21]; // enough to hold all numbers up to 64-bits
sprintf(numstr, "%d", errorCode);
return THROW_ERROR_EXCEPTION("Failed to parse block" + numstr);
}

if (b.major_version < mergedMiningBlockVersion) {
if (!get_block_hashing_blob(b, output))
Expand Down Expand Up @@ -143,7 +147,11 @@ void get_block_id(const Nan::FunctionCallbackInfo<v8::Value>& info) {

block b = AUTO_VAL_INIT(b);
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));
{
char numstr[21]; // enough to hold all numbers up to 64-bits
sprintf(numstr, "%d", errorCode);
return THROW_ERROR_EXCEPTION("Failed to parse block" + numstr);
}

crypto::hash block_id;
if (!get_block_hash(b, block_id, mergedMiningBlockVersion))
Expand Down Expand Up @@ -184,7 +192,11 @@ void construct_block_blob(const Nan::FunctionCallbackInfo<v8::Value>& info) {

block b = AUTO_VAL_INIT(b);
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));
{
char numstr[21]; // enough to hold all numbers up to 64-bits
sprintf(numstr, "%d", errorCode);
return THROW_ERROR_EXCEPTION("Failed to parse block" + numstr);
}

b.nonce = nonce;
if (b.major_version == mergedMiningBlockVersion) {
Expand Down

0 comments on commit be03ab1

Please sign in to comment.