aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-11-29 01:32:01 -0600
committerluigi1111 <luigi1111w@gmail.com>2020-11-29 01:32:01 -0600
commit4c2e77854d8549a68a80e6d4f17e4d62771e4e26 (patch)
tree873734c7486f1ea5f1a3d3f27ef2e69c760c0d70 /src
parentMerge pull request #6903 (diff)
parentwallet2: wait for propagation timeout before marking tx as failed (diff)
downloadmonero-4c2e77854d8549a68a80e6d4f17e4d62771e4e26.tar.xz
Merge pull request #6913
fc2f971 wallet2: wait for propagation timeout before marking tx as failed (xiphon)
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet2.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index a3755ff08..7cbb4a910 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -2961,6 +2961,8 @@ void wallet2::update_pool_state(std::vector<std::tuple<cryptonote::transaction,
MTRACE("update_pool_state got pool");
// remove any pending tx that's not in the pool
+ constexpr const std::chrono::seconds tx_propagation_timeout{CRYPTONOTE_DANDELIONPP_EMBARGO_AVERAGE * 3 / 2};
+ const auto now = std::chrono::system_clock::now();
std::unordered_map<crypto::hash, wallet2::unconfirmed_transfer_details>::iterator it = m_unconfirmed_txs.begin();
while (it != m_unconfirmed_txs.end())
{
@@ -2988,9 +2990,11 @@ void wallet2::update_pool_state(std::vector<std::tuple<cryptonote::transaction,
LOG_PRINT_L1("Pending txid " << txid << " not in pool, marking as not in pool");
pit->second.m_state = wallet2::unconfirmed_transfer_details::pending_not_in_pool;
}
- else if (pit->second.m_state == wallet2::unconfirmed_transfer_details::pending_not_in_pool && refreshed)
+ else if (pit->second.m_state == wallet2::unconfirmed_transfer_details::pending_not_in_pool && refreshed &&
+ now > std::chrono::system_clock::from_time_t(pit->second.m_sent_time) + tx_propagation_timeout)
{
- LOG_PRINT_L1("Pending txid " << txid << " not in pool, marking as failed");
+ LOG_PRINT_L1("Pending txid " << txid << " not in pool after " << tx_propagation_timeout.count() <<
+ " seconds, marking as failed");
pit->second.m_state = wallet2::unconfirmed_transfer_details::failed;
// the inputs aren't spent anymore, since the tx failed