forked from lthn/blockchain
coretests: wlt_lambda_on_transfer2_wrapper moved
This commit is contained in:
parent
1cb908a484
commit
fc68a33bed
3 changed files with 14 additions and 12 deletions
|
|
@ -22,18 +22,6 @@ const std::string g_wallet_password = "dofatibmzibeziyekigo";
|
|||
const currency::account_base null_account = AUTO_VAL_INIT(null_account);
|
||||
|
||||
|
||||
struct wlt_lambda_on_transfer2_wrapper : public tools::i_wallet2_callback
|
||||
{
|
||||
typedef std::function<bool(const tools::wallet_public::wallet_transfer_info&, uint64_t, uint64_t, uint64_t)> Func;
|
||||
wlt_lambda_on_transfer2_wrapper(Func callback) : m_result(false), m_callback(callback) {}
|
||||
virtual void on_transfer2(const tools::wallet_public::wallet_transfer_info& wti, uint64_t balance, uint64_t unlocked_balance, uint64_t total_mined) override
|
||||
{
|
||||
m_result = m_callback(wti, balance, unlocked_balance, total_mined);
|
||||
}
|
||||
bool m_result;
|
||||
Func m_callback;
|
||||
};
|
||||
|
||||
POD_MAKE_COMPARABLE(currency, tx_out);
|
||||
|
||||
// Determines which output is real and actually spent in tx inputs, when there are fake outputs.
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ bool wallet_test::check_balance(currency::core& c, size_t ev_index, const std::v
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<tools::wallet2> wallet_test::init_playtime_test_wallet(const std::vector<test_event_entry>& events, currency::core& c, const account_base& acc) const
|
||||
{
|
||||
CHECK_AND_ASSERT_THROW_MES(events.size() > 0 && events[0].type() == typeid(currency::block), "Invalid events queue, can't find genesis block at the beginning");
|
||||
|
|
@ -84,6 +85,7 @@ std::shared_ptr<tools::wallet2> wallet_test::init_playtime_test_wallet(const std
|
|||
w->set_core_proxy(m_core_proxy);
|
||||
return w;
|
||||
}
|
||||
|
||||
std::shared_ptr<tools::wallet2> wallet_test::init_playtime_test_wallet(const std::vector<test_event_entry>& events, currency::core& c, size_t account_index) const
|
||||
{
|
||||
CHECK_AND_ASSERT_THROW_MES(account_index < m_accounts.size(), "Invalid account index");
|
||||
|
|
|
|||
|
|
@ -87,3 +87,15 @@ struct wallet_callback_balance_checker : public tools::i_wallet2_callback
|
|||
uint64_t m_unlocked_balance;
|
||||
uint64_t m_total_mined;
|
||||
};
|
||||
|
||||
struct wlt_lambda_on_transfer2_wrapper : public tools::i_wallet2_callback
|
||||
{
|
||||
typedef std::function<bool(const tools::wallet_public::wallet_transfer_info&, uint64_t, uint64_t, uint64_t)> Func;
|
||||
wlt_lambda_on_transfer2_wrapper(Func callback) : m_result(false), m_callback(callback) {}
|
||||
virtual void on_transfer2(const tools::wallet_public::wallet_transfer_info& wti, uint64_t balance, uint64_t unlocked_balance, uint64_t total_mined) override
|
||||
{
|
||||
m_result = m_callback(wti, balance, unlocked_balance, total_mined);
|
||||
}
|
||||
bool m_result;
|
||||
Func m_callback;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue