Skip to content
Snippets Groups Projects
Commit a707e0b7 authored by daniil.frolov's avatar daniil.frolov
Browse files

..

parent 77b6d66d
No related branches found
No related tags found
1 merge request!1457hotfix-9744
Pipeline #39982 failed with stage
in 32 minutes and 9 seconds
......@@ -229,7 +229,7 @@ dap_chain_datum_tx_t *dap_ledger_test_create_stake_tx_cond(dap_enc_key_t *a_key_
memset(&l_in_ems->header.token_emission_hash, 0, sizeof(l_in_ems->header.token_emission_hash));
strcpy(l_in_ems->header.ticker, s_delegated_token_ticker);
dap_time_t a_time_staking = dap_time_now();
dap_time_t a_time_staking = 1;
dap_chain_tx_out_cond_t* l_tx_out_cond = dap_chain_datum_tx_item_out_cond_create_srv_stake_lock(
l_uid, a_value, a_time_staking, uint256_0);
......@@ -485,33 +485,41 @@ void dap_ledger_test_datums_removing(dap_ledger_t *a_ledger, dap_hash_fast_t *a_
}
// check stake and unstake adding and removing
// {
// // Create stake lock tx
// dap_chain_datum_tx_t *l_stake_cond_tx = dap_ledger_test_create_stake_tx_cond(a_from_key, a_prev_hash, dap_chain_uint256_from(20U), a_ledger);
// dap_hash_fast_t l_stake_cond_tx_hash = {};
// dap_hash_fast(l_stake_cond_tx, dap_chain_datum_tx_get_size(l_stake_cond_tx), &l_stake_cond_tx_hash);
// int err_code = dap_ledger_tx_add(a_ledger, l_stake_cond_tx, &l_stake_cond_tx_hash, false);
// printf("err_code = %s\n", dap_ledger_tx_check_err_str(err_code));
// dap_assert(!err_code, "Adding of stake cond transaction to ledger is");
// sleep(3);
// // Create stake unlock tx
// dap_chain_datum_tx_t *l_unstake_cond_tx = dap_ledger_test_create_unstake_tx_cond(a_from_key, &l_stake_cond_tx_hash, dap_chain_uint256_from(20U), a_ledger);
// dap_hash_fast_t l_unstake_cond_tx_hash = {};
// dap_hash_fast(l_unstake_cond_tx, dap_chain_datum_tx_get_size(l_stake_cond_tx), &l_unstake_cond_tx_hash);
// err_code = dap_ledger_tx_add(a_ledger, l_unstake_cond_tx, &l_unstake_cond_tx_hash, false);
// printf("err_code = %s\n", dap_ledger_tx_check_err_str(err_code));
// dap_assert(!err_code, "Adding of unstake cond transaction to ledger is");
// dap_assert(!dap_ledger_tx_remove(a_ledger, l_stake_cond_tx, &l_stake_cond_tx_hash), "Test of stake conditional transaction removing from ledger:");
// l_balance_after = dap_ledger_test_print_balance(a_ledger, &l_addr);
// dap_assert(!compare256(l_balance_before, l_balance_after), "Compare balance before creating stake transactions and after removing them. Must be equal:")
// }
{
// Create stake lock tx
dap_chain_datum_tx_t *l_stake_cond_tx = dap_ledger_test_create_stake_tx_cond(a_from_key, a_prev_hash, dap_chain_uint256_from(20U), a_ledger);
dap_hash_fast_t l_stake_cond_tx_hash = {};
dap_hash_fast(l_stake_cond_tx, dap_chain_datum_tx_get_size(l_stake_cond_tx), &l_stake_cond_tx_hash);
int err_code = dap_ledger_tx_add(a_ledger, l_stake_cond_tx, &l_stake_cond_tx_hash, false);
printf("err_code = %s\n", dap_ledger_tx_check_err_str(err_code));
dap_assert(!err_code, "Adding of stake cond transaction to ledger is");
sleep(3);
// Create stake unlock tx
uint256_t l_balance_before_unstaking = dap_ledger_test_print_balance(a_ledger, &l_addr);
dap_chain_datum_tx_t *l_unstake_cond_tx = dap_ledger_test_create_unstake_tx_cond(a_from_key, &l_stake_cond_tx_hash, dap_chain_uint256_from(20U), a_ledger);
dap_hash_fast_t l_unstake_cond_tx_hash = {};
dap_hash_fast(l_unstake_cond_tx, dap_chain_datum_tx_get_size(l_stake_cond_tx), &l_unstake_cond_tx_hash);
err_code = dap_ledger_tx_add(a_ledger, l_unstake_cond_tx, &l_unstake_cond_tx_hash, false);
printf("err_code = %s\n", dap_ledger_tx_check_err_str(err_code));
dap_assert(!err_code, "Adding of unstake cond transaction to ledger is");
err_code = dap_ledger_tx_remove(a_ledger, l_unstake_cond_tx, &l_unstake_cond_tx_hash);
printf("err_code = %s\n", dap_ledger_tx_check_err_str(err_code));
dap_assert(!err_code, "Test of unstake conditional transaction removing from ledger:");
l_balance_after = dap_ledger_test_print_balance(a_ledger, &l_addr);
dap_assert(!compare256(l_balance_before_unstaking, l_balance_after), "Compare balance after creating unstake transactions and after removing them. Must be equal:")
}
// Check delegation
// CHeck rewards
// Check vote removing
// Check voting removing
// Check exchanger
}
dap_hash_fast_t dap_ledger_test_double_spending(
......@@ -792,8 +800,8 @@ void dap_ledger_test_write_back_list(dap_ledger_t *a_ledger, dap_cert_t *a_cert,
void dap_ledger_test_run(void){
dap_set_appname("cellframe-node");
dap_config_init("/opt/cellframe-node/etc/");
dap_assert_PIF((g_config = dap_config_open(dap_get_appname())) != NULL, "Init");
dap_config_init("/opt/cellframe-node/etc");
dap_assert_PIF((g_config = dap_config_open(dap_get_appname())) != NULL, "Init: ");
dap_chain_net_srv_stake_lock_init();
dap_chain_net_srv_stake_pos_delegate_init();
dap_assert_PIF(!dap_chain_net_srv_init(), "Srv initializstion");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment