Simple test to verify assignment of CWalletTx::nSmartTime value. Could be expanded to cover more corner cases of smart time logic.
| 392 | // Simple test to verify assignment of CWalletTx::nSmartTime value. Could be |
| 393 | // expanded to cover more corner cases of smart time logic. |
| 394 | BOOST_AUTO_TEST_CASE(ComputeTimeSmart) |
| 395 | { |
| 396 | // New transaction should use clock time if lower than block time. |
| 397 | BOOST_CHECK_EQUAL(AddTx(*m_node.chainman, m_wallet, 1, 100, 120), 100); |
| 398 | |
| 399 | // Test that updating existing transaction does not change smart time. |
| 400 | BOOST_CHECK_EQUAL(AddTx(*m_node.chainman, m_wallet, 1, 200, 220), 100); |
| 401 | |
| 402 | // New transaction should use clock time if there's no block time. |
| 403 | BOOST_CHECK_EQUAL(AddTx(*m_node.chainman, m_wallet, 2, 300, 0), 300); |
| 404 | |
| 405 | // New transaction should use block time if lower than clock time. |
| 406 | BOOST_CHECK_EQUAL(AddTx(*m_node.chainman, m_wallet, 3, 420, 400), 400); |
| 407 | |
| 408 | // New transaction should use latest entry time if higher than |
| 409 | // min(block time, clock time). |
| 410 | BOOST_CHECK_EQUAL(AddTx(*m_node.chainman, m_wallet, 4, 500, 390), 400); |
| 411 | |
| 412 | // If there are future entries, new transaction should use time of the |
| 413 | // newest entry that is no more than 300 seconds ahead of the clock time. |
| 414 | BOOST_CHECK_EQUAL(AddTx(*m_node.chainman, m_wallet, 5, 50, 600), 300); |
| 415 | } |
| 416 | |
| 417 | BOOST_AUTO_TEST_CASE(LoadReceiveRequests) |
| 418 | { |
nothing calls this directly
no test coverage detected