More debugging
This commit is contained in:
@@ -486,7 +486,9 @@ namespace cryptonote
|
||||
VARINT_FIELD(minor_version)
|
||||
if (BLOCK_MAJOR_VERSION_1 == major_version)
|
||||
{
|
||||
puts("[6");
|
||||
VARINT_FIELD(timestamp)
|
||||
puts("]6");
|
||||
}
|
||||
FIELD(prev_id)
|
||||
if (BLOCK_MAJOR_VERSION_1 == major_version)
|
||||
@@ -507,8 +509,10 @@ namespace cryptonote
|
||||
FIELDS(*static_cast<block_header *>(this))
|
||||
if (BLOCK_MAJOR_VERSION_2 <= major_version)
|
||||
{
|
||||
puts("[7");
|
||||
auto sbb = make_serializable_bytecoin_block(*this, false, false);
|
||||
FIELD_N("parent_block", sbb);
|
||||
puts("]7");
|
||||
}
|
||||
FIELD(miner_tx)
|
||||
FIELD(tx_hashes)
|
||||
|
||||
@@ -707,12 +707,14 @@ namespace cryptonote
|
||||
|
||||
if (BLOCK_MAJOR_VERSION_2 <= b.major_version)
|
||||
{
|
||||
puts("[5");
|
||||
blobdata parent_blob;
|
||||
auto sbb = make_serializable_bytecoin_block(b, true, false);
|
||||
if (!t_serializable_object_to_blob(sbb, parent_blob))
|
||||
return false;
|
||||
|
||||
blob.append(parent_blob);
|
||||
puts("]5");
|
||||
}
|
||||
|
||||
return get_object_hash(blob, res);
|
||||
@@ -753,8 +755,10 @@ namespace cryptonote
|
||||
string_tools::parse_hexstr_to_binbuff(genesis_coinbase_tx_hex, tx_bl);
|
||||
bool r = parse_and_validate_tx_from_blob(tx_bl, bl.miner_tx);
|
||||
CHECK_AND_ASSERT_MES(r, false, "failed to parse coinbase tx from hard coded blob");
|
||||
puts("[4");
|
||||
bl.major_version = CURRENT_BLOCK_MAJOR_VERSION;
|
||||
bl.minor_version = CURRENT_BLOCK_MINOR_VERSION;
|
||||
puts("]4");
|
||||
bl.timestamp = 0;
|
||||
bl.nonce = 10000;
|
||||
miner::find_nonce_for_given_block(bl, 1, 0);
|
||||
@@ -906,8 +910,10 @@ namespace cryptonote
|
||||
//---------------------------------------------------------------
|
||||
bool check_proof_of_work_v1(const block& bl, difficulty_type current_diffic, crypto::hash& proof_of_work)
|
||||
{
|
||||
puts("[3");
|
||||
if (BLOCK_MAJOR_VERSION_1 != bl.major_version)
|
||||
return false;
|
||||
puts("]3");
|
||||
|
||||
proof_of_work = get_block_longhash(bl, 0);
|
||||
return check_hash(proof_of_work, current_diffic);
|
||||
@@ -915,9 +921,11 @@ namespace cryptonote
|
||||
//---------------------------------------------------------------
|
||||
bool check_proof_of_work_v2(const block& bl, difficulty_type current_diffic, crypto::hash& proof_of_work)
|
||||
{
|
||||
puts("[2");
|
||||
if (BLOCK_MAJOR_VERSION_2 != bl.major_version &&
|
||||
BLOCK_MAJOR_VERSION_3 != bl.major_version)
|
||||
return false;
|
||||
puts("]2");
|
||||
|
||||
if (!get_bytecoin_block_longhash(bl, proof_of_work))
|
||||
return false;
|
||||
@@ -952,12 +960,14 @@ namespace cryptonote
|
||||
//---------------------------------------------------------------
|
||||
bool check_proof_of_work(const block& bl, difficulty_type current_diffic, crypto::hash& proof_of_work)
|
||||
{
|
||||
puts("[1");
|
||||
switch (bl.major_version)
|
||||
{
|
||||
case BLOCK_MAJOR_VERSION_1: return check_proof_of_work_v1(bl, current_diffic, proof_of_work);
|
||||
case BLOCK_MAJOR_VERSION_2: return check_proof_of_work_v2(bl, current_diffic, proof_of_work);
|
||||
case BLOCK_MAJOR_VERSION_3: return check_proof_of_work_v2(bl, current_diffic, proof_of_work);
|
||||
}
|
||||
puts("]1");
|
||||
|
||||
CHECK_AND_ASSERT_MES(false, false, "unknown block major version: " << bl.major_version << "." << bl.minor_version);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user