Skip to content

Commit 81a23c7

Browse files
committed
Merge pull request #6914
f9a9d2e wallet2: wait for propagation timeout before marking tx as failed (xiphon)
2 parents 4b86583 + f9a9d2e commit 81a23c7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/wallet/wallet2.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,6 +2961,8 @@ void wallet2::update_pool_state(std::vector<std::tuple<cryptonote::transaction,
29612961
MTRACE("update_pool_state got pool");
29622962

29632963
// remove any pending tx that's not in the pool
2964+
constexpr const std::chrono::seconds tx_propagation_timeout{CRYPTONOTE_DANDELIONPP_EMBARGO_AVERAGE * 3 / 2};
2965+
const auto now = std::chrono::system_clock::now();
29642966
std::unordered_map<crypto::hash, wallet2::unconfirmed_transfer_details>::iterator it = m_unconfirmed_txs.begin();
29652967
while (it != m_unconfirmed_txs.end())
29662968
{
@@ -2988,9 +2990,11 @@ void wallet2::update_pool_state(std::vector<std::tuple<cryptonote::transaction,
29882990
LOG_PRINT_L1("Pending txid " << txid << " not in pool, marking as not in pool");
29892991
pit->second.m_state = wallet2::unconfirmed_transfer_details::pending_not_in_pool;
29902992
}
2991-
else if (pit->second.m_state == wallet2::unconfirmed_transfer_details::pending_not_in_pool && refreshed)
2993+
else if (pit->second.m_state == wallet2::unconfirmed_transfer_details::pending_not_in_pool && refreshed &&
2994+
now > std::chrono::system_clock::from_time_t(pit->second.m_sent_time) + tx_propagation_timeout)
29922995
{
2993-
LOG_PRINT_L1("Pending txid " << txid << " not in pool, marking as failed");
2996+
LOG_PRINT_L1("Pending txid " << txid << " not in pool after " << tx_propagation_timeout.count() <<
2997+
" seconds, marking as failed");
29942998
pit->second.m_state = wallet2::unconfirmed_transfer_details::failed;
29952999

29963000
// the inputs aren't spent anymore, since the tx failed

0 commit comments

Comments
 (0)