MCPcopy Create free account
hub / github.com/ElementsProject/elements / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

src/wallet/test/wallet_tests.cpp:394–415  ·  view source on GitHub ↗

Simple test to verify assignment of CWalletTx::nSmartTime value. Could be expanded to cover more corner cases of smart time logic.

Source from the content-addressed store, hash-verified

392// Simple test to verify assignment of CWalletTx::nSmartTime value. Could be
393// expanded to cover more corner cases of smart time logic.
394BOOST_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
417BOOST_AUTO_TEST_CASE(LoadReceiveRequests)
418{

Callers

nothing calls this directly

Calls 14

AddTxFunction · 0.85
PKHashClass · 0.85
TestWatchOnlyPubKeyFunction · 0.85
PollutePubKeyFunction · 0.85
SetAddressUsedMethod · 0.80
HaveWatchOnlyMethod · 0.80
MakeNewKeyMethod · 0.80
CPubKeyClass · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected