1
0
Fork 0
forked from lthn/blockchain

coretests: forgotten changes (wip for hard_fork_4_consolidated_txs)

This commit is contained in:
sowle 2024-01-15 23:15:24 +01:00
parent 250bf95e11
commit 929d741916
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
2 changed files with 17 additions and 7 deletions

View file

@ -1240,6 +1240,9 @@ int main(int argc, char* argv[])
GENERATE_AND_PLAY(hard_fork_2_incorrect_alias_update<true>);
GENERATE_AND_PLAY(hard_fork_2_incorrect_alias_update<false>);
// HF4
// GENERATE_AND_PLAY_HF(hard_fork_4_consolidated_txs, "4"); TODO, doesn't work atm -- sowle
// atomics
GENERATE_AND_PLAY(atomic_simple_test);
GENERATE_AND_PLAY(atomic_test_wrong_redeem_wrong_refund);

View file

@ -51,6 +51,11 @@ namespace currency
}
} // namespace currency
void add_flags_to_all_destination_entries(const uint64_t flags, std::vector<currency::tx_destination_entry>& destinations)
{
for(auto& de : destinations)
de.flags |= flags;
}
//-------------------------------
@ -116,13 +121,15 @@ bool hard_fork_4_consolidated_txs::generate(std::vector<test_event_entry>& event
destinations.push_back(tx_destination_entry(miner_change, miner_acc.get_public_address()));
destinations.push_back(tx_destination_entry(bob_amount, bob_acc.get_public_address()));
add_flags_to_all_destination_entries(tx_destination_entry_flags::tdef_explicit_native_asset_id, destinations);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_extra, empty_attachment, tx_1, get_tx_version_from_events(events), one_time_secret_key,
0, 0, 0, true, TX_FLAG_SIGNATURE_MODE_SEPARATE, TX_DEFAULT_FEE, gen_context);
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
// partially completed tx_1 shouldn't be accepted
DO_CALLBACK(events, "mark_invalid_tx");
//DO_CALLBACK(events, "mark_invalid_tx");
ADD_CUSTOM_EVENT(events, tx_1);
MAKE_NEXT_BLOCK_TX1(events, blk_2a, blk_1r, miner_acc, tx_1);
}
@ -144,12 +151,12 @@ bool hard_fork_4_consolidated_txs::generate(std::vector<test_event_entry>& event
}
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, tx_1);
std::shared_ptr<tools::wallet2> bob_wlt;
r = generator.init_test_wallet(bob_acc, get_block_hash(blk_0), bob_wlt);
CHECK_AND_ASSERT_MES(r, false, "init_test_wallet failed");
r = generator.refresh_test_wallet(events, bob_wlt.get(), get_block_hash(blk_2), 2 * CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 2);
CHECK_AND_ASSERT_MES(r, false, "refresh_test_wallet failed");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_amount, 0, 0, 0, 0), false, "");
//std::shared_ptr<tools::wallet2> bob_wlt;
//r = generator.init_test_wallet(bob_acc, get_block_hash(blk_0), bob_wlt);
//CHECK_AND_ASSERT_MES(r, false, "init_test_wallet failed");
//r = generator.refresh_test_wallet(events, bob_wlt.get(), get_block_hash(blk_2), 2 * CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 2);
//CHECK_AND_ASSERT_MES(r, false, "refresh_test_wallet failed");
//CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_amount, 0, 0, 0, 0), false, "");
return true;