|
|
@ -3648,6 +3648,22 @@ static std::string get_human_readable_timestamp(uint64_t ts)
|
|
|
|
return std::string(buffer);
|
|
|
|
return std::string(buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static std::string get_human_readable_timespan(std::chrono::seconds seconds)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint64_t ts = seconds.count();
|
|
|
|
|
|
|
|
if (ts < 60)
|
|
|
|
|
|
|
|
return std::to_string(ts) + tr(" seconds");
|
|
|
|
|
|
|
|
if (ts < 3600)
|
|
|
|
|
|
|
|
return std::to_string((uint64_t)(ts / 60)) + tr(" minutes");
|
|
|
|
|
|
|
|
if (ts < 3600 * 24)
|
|
|
|
|
|
|
|
return std::to_string((uint64_t)(ts / 3600)) + tr(" hours");
|
|
|
|
|
|
|
|
if (ts < 3600 * 24 * 30.5)
|
|
|
|
|
|
|
|
return std::to_string((uint64_t)(ts / (3600 * 24))) + tr(" days");
|
|
|
|
|
|
|
|
if (ts < 3600 * 24 * 365.25)
|
|
|
|
|
|
|
|
return std::to_string((uint64_t)(ts / (3600 * 24 * 365.25))) + tr(" months");
|
|
|
|
|
|
|
|
return tr("a long time");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
|
|
|
|
bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::vector<std::string> local_args = args_;
|
|
|
|
std::vector<std::string> local_args = args_;
|
|
|
@ -4454,6 +4470,8 @@ bool simple_wallet::show_transfer(const std::vector<std::string> &args)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data());
|
|
|
|
crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint64_t last_block_height = m_wallet->get_blockchain_current_height();
|
|
|
|
|
|
|
|
|
|
|
|
std::list<std::pair<crypto::hash, tools::wallet2::payment_details>> payments;
|
|
|
|
std::list<std::pair<crypto::hash, tools::wallet2::payment_details>> payments;
|
|
|
|
m_wallet->get_payments(payments, 0);
|
|
|
|
m_wallet->get_payments(payments, 0);
|
|
|
|
for (std::list<std::pair<crypto::hash, tools::wallet2::payment_details>>::const_iterator i = payments.begin(); i != payments.end(); ++i) {
|
|
|
|
for (std::list<std::pair<crypto::hash, tools::wallet2::payment_details>>::const_iterator i = payments.begin(); i != payments.end(); ++i) {
|
|
|
@ -4468,6 +4486,23 @@ bool simple_wallet::show_transfer(const std::vector<std::string> &args)
|
|
|
|
success_msg_writer() << "Timestamp: " << get_human_readable_timestamp(pd.m_timestamp);
|
|
|
|
success_msg_writer() << "Timestamp: " << get_human_readable_timestamp(pd.m_timestamp);
|
|
|
|
success_msg_writer() << "Amount: " << print_money(pd.m_amount);
|
|
|
|
success_msg_writer() << "Amount: " << print_money(pd.m_amount);
|
|
|
|
success_msg_writer() << "Payment ID: " << payment_id;
|
|
|
|
success_msg_writer() << "Payment ID: " << payment_id;
|
|
|
|
|
|
|
|
if (pd.m_unlock_time < CRYPTONOTE_MAX_BLOCK_NUMBER)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint64_t bh = std::max(pd.m_unlock_time, pd.m_block_height + CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE);
|
|
|
|
|
|
|
|
if (bh >= last_block_height)
|
|
|
|
|
|
|
|
success_msg_writer() << "Locked: " << (bh - last_block_height) << " blocks to unlock";
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
success_msg_writer() << std::to_string(last_block_height - bh) << " confirmations";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint64_t current_time = static_cast<uint64_t>(time(NULL));
|
|
|
|
|
|
|
|
uint64_t threshold = current_time + (m_wallet->use_fork_rules(2, 0) ? CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V2 : CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V1);
|
|
|
|
|
|
|
|
if (threshold >= pd.m_unlock_time)
|
|
|
|
|
|
|
|
success_msg_writer() << "unlocked for " << get_human_readable_timespan(std::chrono::seconds(threshold - pd.m_unlock_time));
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
success_msg_writer() << "locked for " << get_human_readable_timespan(std::chrono::seconds(pd.m_unlock_time - threshold));
|
|
|
|
|
|
|
|
}
|
|
|
|
success_msg_writer() << "Note: " << m_wallet->get_tx_note(txid);
|
|
|
|
success_msg_writer() << "Note: " << m_wallet->get_tx_note(txid);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|