mirror of
https://github.com/monero-project/monero.git
synced 2025-05-28 16:42:15 -04:00
Fix V1/V2 use of hard fork related parameters
Some of it uses hardcoded height, which will need some thinking for next (voted upon) fork.
This commit is contained in:
parent
60b064c759
commit
3b1d7e03fc
13 changed files with 89 additions and 45 deletions
|
@ -1450,7 +1450,7 @@ void wallet2::rescan_blockchain(bool refresh)
|
|||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::is_transfer_unlocked(const transfer_details& td) const
|
||||
{
|
||||
if(!is_tx_spendtime_unlocked(td.m_tx.unlock_time))
|
||||
if(!is_tx_spendtime_unlocked(td.m_tx.unlock_time, td.m_block_height))
|
||||
return false;
|
||||
|
||||
if(td.m_block_height + CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE > m_blockchain.size())
|
||||
|
@ -1459,7 +1459,7 @@ bool wallet2::is_transfer_unlocked(const transfer_details& td) const
|
|||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::is_tx_spendtime_unlocked(uint64_t unlock_time) const
|
||||
bool wallet2::is_tx_spendtime_unlocked(uint64_t unlock_time, uint64_t block_height) const
|
||||
{
|
||||
if(unlock_time < CRYPTONOTE_MAX_BLOCK_NUMBER)
|
||||
{
|
||||
|
@ -1472,7 +1472,11 @@ bool wallet2::is_tx_spendtime_unlocked(uint64_t unlock_time) const
|
|||
{
|
||||
//interpret as time
|
||||
uint64_t current_time = static_cast<uint64_t>(time(NULL));
|
||||
if(current_time + CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS >= unlock_time)
|
||||
// XXX: this needs to be fast, so we'd need to get the starting heights
|
||||
// from the daemon to be correct once voting kicks in
|
||||
uint64_t v2height = m_testnet ? 624634 : 1009827;
|
||||
uint64_t leeway = block_height < v2height ? CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V1 : CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V2;
|
||||
if(current_time + leeway >= unlock_time)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@ -2417,7 +2421,7 @@ uint64_t wallet2::get_upper_tranaction_size_limit()
|
|||
{
|
||||
if (m_upper_transaction_size_limit > 0)
|
||||
return m_upper_transaction_size_limit;
|
||||
uint64_t full_reward_zone = use_fork_rules(2) ? CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE : CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1;
|
||||
uint64_t full_reward_zone = use_fork_rules(2) ? CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2 : CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1;
|
||||
return ((full_reward_zone * 125) / 100) - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue