aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorJaquee <jaquee.monero@gmail.com>2017-08-04 23:05:02 +0200
committerJaquee <jaquee.monero@gmail.com>2017-10-15 17:48:45 +0200
commit43b57804f8fec564083d892602fa599aa3f330fd (patch)
tree5d211544740a664448af9df964855ecfc2519492 /src/wallet/wallet2.cpp
parentwallet2: add lightwallet exceptions to common functions (diff)
downloadmonero-43b57804f8fec564083d892602fa599aa3f330fd.tar.xz
wallet2: refactor is_tx_spendtime_unlocked()
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 263042a24..ef0e53b24 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -3160,10 +3160,15 @@ 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, td.m_block_height))
+ return is_transfer_unlocked(td.m_tx.unlock_time, td.m_block_height);
+}
+//----------------------------------------------------------------------------------------------------
+bool wallet2::is_transfer_unlocked(uint64_t unlock_time, uint64_t block_height) const
+{
+ if(!is_tx_spendtime_unlocked(unlock_time, block_height))
return false;
- if(td.m_block_height + CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE > m_blockchain.size())
+ if(block_height + CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE > m_local_bc_height)
return false;
return true;
@@ -3174,7 +3179,7 @@ bool wallet2::is_tx_spendtime_unlocked(uint64_t unlock_time, uint64_t block_heig
if(unlock_time < CRYPTONOTE_MAX_BLOCK_NUMBER)
{
//interpret as block index
- if(m_blockchain.size()-1 + CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS >= unlock_time)
+ if(m_local_bc_height-1 + CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS >= unlock_time)
return true;
else
return false;