fixed coinbase unlock 288 blks

remotes/1691602464505633909/tmp_refs/heads/wonerujo-v0.10.1
wowario 3 years ago
parent 7f7d697f43
commit c49a72f1ce

@ -40,6 +40,8 @@
#define CRYPTONOTE_MAX_TX_SIZE 1000000
#define CRYPTONOTE_MAX_TX_PER_BLOCK 0x10000000
#define CRYPTONOTE_PUBLIC_ADDRESS_TEXTBLOB_VER 0
#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW_V2 288
#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW 60
#define CURRENT_TRANSACTION_VERSION 2
#define CURRENT_BLOCK_MAJOR_VERSION 7
#define CURRENT_BLOCK_MINOR_VERSION 7
@ -191,6 +193,7 @@
#define HF_VERSION_CLSAG 16
#define HF_VERSION_DETERMINISTIC_UNLOCK_TIME 16
#define HF_VERSION_DYNAMIC_UNLOCK 16
#define HF_VERSION_FIXED_UNLOCK 18
#define PER_KB_FEE_QUANTIZATION_DECIMALS 8

@ -1423,12 +1423,11 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
}
MDEBUG("Miner tx hash: " << get_transaction_hash(b.miner_tx));
// Dynamic unlock time from HF 16
// To calculate unlock window, get the block hash at height-1337, convert the
// first 3 characters from hexadecimal to decimal, multiply by 2, and then add 288.
// Unlock minimum 1 day (288 blocks), maximum is ~29 days ((4095*2)+288 = 8478 blocks)
// unlock time = unlock_window + height
if (hf_version >= HF_VERSION_DYNAMIC_UNLOCK)
if (hf_version >= HF_VERSION_FIXED_UNLOCK)
{
CHECK_AND_ASSERT_MES(b.miner_tx.unlock_time == height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW_V2, false, "coinbase transaction transaction has the wrong unlock time="
<< b.miner_tx.unlock_time << ", expected " << height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW_V2);
} else if (hf_version < HF_VERSION_FIXED_UNLOCK && hf_version >= HF_VERSION_DYNAMIC_UNLOCK)
{
uint64_t N = m_nettype == MAINNET ? 1337 : 5;
crypto::hash blk_id = get_block_id_by_height(height-N);
@ -1445,8 +1444,8 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
"\nblk_height: " << height-N << ", blk_id: " << blk_id <<
"\nhex_str: " << hex_str << ", blk_num: " << blk_num);
} else {
CHECK_AND_ASSERT_MES(b.miner_tx.unlock_time == height + 60, false, "coinbase transaction transaction has the wrong unlock time="
<< b.miner_tx.unlock_time << ", expected " << height + 60);
CHECK_AND_ASSERT_MES(b.miner_tx.unlock_time == height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, false, "coinbase transaction transaction has the wrong unlock time="
<< b.miner_tx.unlock_time << ", expected " << height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW);
}
//check outs overflow

@ -167,7 +167,10 @@ namespace cryptonote
tx.version = 1;
//lock
if (hard_fork_version >= HF_VERSION_DYNAMIC_UNLOCK)
if (hard_fork_version >= HF_VERSION_FIXED_UNLOCK)
{
tx.unlock_time = height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW_V2;
} else if (hard_fork_version < HF_VERSION_FIXED_UNLOCK && hard_fork_version >= HF_VERSION_DYNAMIC_UNLOCK)
{
uint64_t N = m_nettype == MAINNET ? 1337 : 5;
crypto::hash blk_id = pb->get_block_id_by_height(height-N);
@ -176,7 +179,7 @@ namespace cryptonote
uint64_t unlock_window = blk_num + 288;
tx.unlock_time = height + unlock_window;
} else {
tx.unlock_time = height + 60;
tx.unlock_time = height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW;
}
tx.vin.push_back(in);

Loading…
Cancel
Save