aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-01-29 15:09:17 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-01-29 17:21:11 +0000
commit3b1d7e03fcc1caa8898ced33e127f6ba09d66df8 (patch)
treedbec9bdbe5dc27b3c420433b99750ef036827489 /src/wallet
parentMerge pull request #626 (diff)
downloadmonero-3b1d7e03fcc1caa8898ced33e127f6ba09d66df8.tar.xz
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.
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet2.cpp12
-rw-r--r--src/wallet/wallet2.h2
2 files changed, 9 insertions, 5 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 55e290c0c..d636b0e4b 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -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;
}
//----------------------------------------------------------------------------------------------------
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index 9912226c6..e29619444 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -356,7 +356,7 @@ namespace tools
void process_new_blockchain_entry(const cryptonote::block& b, const cryptonote::block_complete_entry& bche, const crypto::hash& bl_id, uint64_t height);
void detach_blockchain(uint64_t height);
void get_short_chain_history(std::list<crypto::hash>& ids) const;
- bool is_tx_spendtime_unlocked(uint64_t unlock_time) const;
+ bool is_tx_spendtime_unlocked(uint64_t unlock_time, uint64_t block_height) const;
bool is_transfer_unlocked(const transfer_details& td) const;
bool clear();
void pull_blocks(uint64_t start_height, uint64_t& blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::list<cryptonote::block_complete_entry> &blocks);