Fix tests failing after PR#1939 (#1966)

* Fix failing after #1939 tests

https://github.com/nanocurrency/nano-node/pull/1939

* Fix history.short_text test
This commit is contained in:
Sergey Kroshnin 2019-05-08 12:48:45 +03:00 committed by GitHub
commit 95fdb3455d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 11 deletions

View file

@ -486,11 +486,12 @@ TEST (history, short_text)
auto transaction (store.tx_begin_write ());
store.initialize (transaction, genesis);
nano::keypair key;
nano::send_block send (ledger.latest (transaction, nano::test_genesis_key.pub), nano::test_genesis_key.pub, 0, nano::test_genesis_key.prv, nano::test_genesis_key.pub, 0);
auto latest (ledger.latest (transaction, nano::test_genesis_key.pub));
nano::send_block send (latest, nano::test_genesis_key.pub, 0, nano::test_genesis_key.prv, nano::test_genesis_key.pub, system.work.generate (latest));
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, send).code);
nano::receive_block receive (send.hash (), send.hash (), nano::test_genesis_key.prv, nano::test_genesis_key.pub, 0);
nano::receive_block receive (send.hash (), send.hash (), nano::test_genesis_key.prv, nano::test_genesis_key.pub, system.work.generate (send.hash ()));
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, receive).code);
nano::change_block change (receive.hash (), key.pub, nano::test_genesis_key.prv, nano::test_genesis_key.pub, 0);
nano::change_block change (receive.hash (), key.pub, nano::test_genesis_key.prv, nano::test_genesis_key.pub, system.work.generate (receive.hash ()));
ASSERT_EQ (nano::process_result::progress, ledger.process (transaction, change).code);
}
nano_qt::history history (ledger, nano::test_genesis_key.pub, *wallet);
@ -598,7 +599,8 @@ TEST (wallet, republish)
nano::block_hash hash;
{
auto transaction (system.nodes[0]->store.tx_begin_write ());
nano::send_block block (system.nodes[0]->ledger.latest (transaction, nano::test_genesis_key.pub), key.pub, 0, nano::test_genesis_key.prv, nano::test_genesis_key.pub, 0);
auto latest (system.nodes[0]->ledger.latest (transaction, nano::test_genesis_key.pub));
nano::send_block block (latest, key.pub, 0, nano::test_genesis_key.prv, nano::test_genesis_key.pub, system.work.generate (latest));
hash = block.hash ();
ASSERT_EQ (nano::process_result::progress, system.nodes[0]->ledger.process (transaction, block).code);
}

View file

@ -1333,9 +1333,9 @@ TEST (rpc, history)
ASSERT_NE (nullptr, receive);
auto node0 (system.nodes[0]);
nano::genesis genesis;
nano::state_block usend (nano::genesis_account, node0->latest (nano::genesis_account), nano::genesis_account, nano::genesis_amount - nano::Gxrb_ratio, nano::genesis_account, nano::test_genesis_key.prv, nano::test_genesis_key.pub, 0);
nano::state_block ureceive (nano::genesis_account, usend.hash (), nano::genesis_account, nano::genesis_amount, usend.hash (), nano::test_genesis_key.prv, nano::test_genesis_key.pub, 0);
nano::state_block uchange (nano::genesis_account, ureceive.hash (), nano::keypair ().pub, nano::genesis_amount, 0, nano::test_genesis_key.prv, nano::test_genesis_key.pub, 0);
nano::state_block usend (nano::genesis_account, node0->latest (nano::genesis_account), nano::genesis_account, nano::genesis_amount - nano::Gxrb_ratio, nano::genesis_account, nano::test_genesis_key.prv, nano::test_genesis_key.pub, system.nodes[0]->work_generate_blocking (node0->latest (nano::genesis_account)));
nano::state_block ureceive (nano::genesis_account, usend.hash (), nano::genesis_account, nano::genesis_amount, usend.hash (), nano::test_genesis_key.prv, nano::test_genesis_key.pub, system.nodes[0]->work_generate_blocking (usend.hash ()));
nano::state_block uchange (nano::genesis_account, ureceive.hash (), nano::keypair ().pub, nano::genesis_amount, 0, nano::test_genesis_key.prv, nano::test_genesis_key.pub, system.nodes[0]->work_generate_blocking (ureceive.hash ()));
{
auto transaction (node0->store.tx_begin_write ());
ASSERT_EQ (nano::process_result::progress, node0->ledger.process (transaction, usend).code);
@ -1402,9 +1402,9 @@ TEST (rpc, account_history)
ASSERT_NE (nullptr, receive);
auto node0 (system.nodes[0]);
nano::genesis genesis;
nano::state_block usend (nano::genesis_account, node0->latest (nano::genesis_account), nano::genesis_account, nano::genesis_amount - nano::Gxrb_ratio, nano::genesis_account, nano::test_genesis_key.prv, nano::test_genesis_key.pub, 0);
nano::state_block ureceive (nano::genesis_account, usend.hash (), nano::genesis_account, nano::genesis_amount, usend.hash (), nano::test_genesis_key.prv, nano::test_genesis_key.pub, 0);
nano::state_block uchange (nano::genesis_account, ureceive.hash (), nano::keypair ().pub, nano::genesis_amount, 0, nano::test_genesis_key.prv, nano::test_genesis_key.pub, 0);
nano::state_block usend (nano::genesis_account, node0->latest (nano::genesis_account), nano::genesis_account, nano::genesis_amount - nano::Gxrb_ratio, nano::genesis_account, nano::test_genesis_key.prv, nano::test_genesis_key.pub, system.nodes[0]->work_generate_blocking (node0->latest (nano::genesis_account)));
nano::state_block ureceive (nano::genesis_account, usend.hash (), nano::genesis_account, nano::genesis_amount, usend.hash (), nano::test_genesis_key.prv, nano::test_genesis_key.pub, system.nodes[0]->work_generate_blocking (usend.hash ()));
nano::state_block uchange (nano::genesis_account, ureceive.hash (), nano::keypair ().pub, nano::genesis_amount, 0, nano::test_genesis_key.prv, nano::test_genesis_key.pub, system.nodes[0]->work_generate_blocking (ureceive.hash ()));
{
auto transaction (node0->store.tx_begin_write ());
ASSERT_EQ (nano::process_result::progress, node0->ledger.process (transaction, usend).code);
@ -4960,7 +4960,7 @@ TEST (rpc, block_create_state_open)
request.put ("representative", nano::test_genesis_key.pub.to_account ());
request.put ("balance", nano::Gxrb_ratio.convert_to<std::string> ());
request.put ("link", send_block->hash ().to_string ());
request.put ("work", nano::to_string_hex (system.nodes[0]->work_generate_blocking (send_block->hash ())));
request.put ("work", nano::to_string_hex (system.nodes[0]->work_generate_blocking (key.pub)));
auto node = system.nodes.front ();
enable_ipc_transport_tcp (node->config.ipc_config.transport_tcp);
nano::node_rpc_config node_rpc_config;