Fix rpc.wallet_history failures (#2739)

This was simply due to the first block getting auto received on confirmation so the `receive_action` would fail. Disabling voting solves it.

Removed the thread sleeps, they don't seem to be required for this test.
This commit is contained in:
Guilherme Lawless 2020-04-27 17:26:28 +01:00 committed by GitHub
commit 7908e2d5e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7260,17 +7260,17 @@ TEST (rpc, uptime)
TEST (rpc, wallet_history) TEST (rpc, wallet_history)
{ {
nano::system system; nano::system system;
auto node = add_ipc_enabled_node (system); nano::node_config node_config (nano::get_available_port (), system.logging);
node_config.enable_voting = false;
auto node = add_ipc_enabled_node (system, node_config);
system.wallet (0)->insert_adhoc (nano::test_genesis_key.prv); system.wallet (0)->insert_adhoc (nano::test_genesis_key.prv);
auto timestamp1 (nano::seconds_since_epoch ()); auto timestamp1 (nano::seconds_since_epoch ());
auto send (system.wallet (0)->send_action (nano::test_genesis_key.pub, nano::test_genesis_key.pub, node->config.receive_minimum.number ())); auto send (system.wallet (0)->send_action (nano::test_genesis_key.pub, nano::test_genesis_key.pub, node->config.receive_minimum.number ()));
ASSERT_NE (nullptr, send); ASSERT_NE (nullptr, send);
std::this_thread::sleep_for (std::chrono::milliseconds (1000));
auto timestamp2 (nano::seconds_since_epoch ()); auto timestamp2 (nano::seconds_since_epoch ());
auto receive (system.wallet (0)->receive_action (*send, nano::test_genesis_key.pub, node->config.receive_minimum.number ())); auto receive (system.wallet (0)->receive_action (*send, nano::test_genesis_key.pub, node->config.receive_minimum.number ()));
ASSERT_NE (nullptr, receive); ASSERT_NE (nullptr, receive);
nano::keypair key; nano::keypair key;
std::this_thread::sleep_for (std::chrono::milliseconds (1000));
auto timestamp3 (nano::seconds_since_epoch ()); auto timestamp3 (nano::seconds_since_epoch ());
auto send2 (system.wallet (0)->send_action (nano::test_genesis_key.pub, key.pub, node->config.receive_minimum.number ())); auto send2 (system.wallet (0)->send_action (nano::test_genesis_key.pub, key.pub, node->config.receive_minimum.number ()));
ASSERT_NE (nullptr, send2); ASSERT_NE (nullptr, send2);