mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-11-11 02:33:54 +01:00
register to on_unconfirmed_money_received() events
This commit is contained in:
@@ -75,11 +75,11 @@ namespace monero {
|
||||
/**
|
||||
* Invoked when sync progress is made.
|
||||
*
|
||||
* @param height is the height of the synced block
|
||||
* @param start_height is the starting height of the sync request
|
||||
* @param end_height is the ending height of the sync request
|
||||
* @param percent_done is the sync progress as a percentage
|
||||
* @param message is a human-readable description of the current progress
|
||||
* @param height - height of the synced block
|
||||
* @param start_height - starting height of the sync request
|
||||
* @param end_height - ending height of the sync request
|
||||
* @param percent_done - sync progress as a percentage
|
||||
* @param message - human-readable description of the current progress
|
||||
*/
|
||||
virtual void on_sync_progress(uint64_t height, uint64_t start_height, uint64_t end_height, double percent_done, const string& message) {}
|
||||
};
|
||||
@@ -93,21 +93,21 @@ namespace monero {
|
||||
/**
|
||||
* Invoked when a new block is processed.
|
||||
*
|
||||
* @param block is the newly processed block
|
||||
* @param block - the newly processed block
|
||||
*/
|
||||
virtual void on_new_block(uint64_t height) {};
|
||||
|
||||
/**
|
||||
* Invoked when the wallet receives an output.
|
||||
*
|
||||
* @param output is the incoming output to the wallet
|
||||
* @param output - the received output
|
||||
*/
|
||||
virtual void on_output_received(const monero_output_wallet& output) {};
|
||||
|
||||
/**
|
||||
* Invoked when the wallet spends an output.
|
||||
*
|
||||
* @param output the outgoing transfer from the wallet
|
||||
* @param output - the spent output
|
||||
*/
|
||||
virtual void on_output_spent(const monero_output_wallet& output) {};
|
||||
};
|
||||
|
||||
@@ -709,6 +709,29 @@ namespace monero {
|
||||
}
|
||||
}
|
||||
|
||||
void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& cn_tx, uint64_t amount, const cryptonote::subaddress_index& subaddr_index) {
|
||||
MTRACE("wallet2_listener::on_unconfirmed_money_received()");
|
||||
|
||||
// create library tx
|
||||
shared_ptr<monero_tx_wallet> tx = static_pointer_cast<monero_tx_wallet>(monero_utils::cn_tx_to_tx(cn_tx, true));
|
||||
tx->m_hash = epee::string_tools::pod_to_hex(txid);
|
||||
shared_ptr<monero_output_wallet> output = make_shared<monero_output_wallet>();
|
||||
tx->m_outputs.push_back(output);
|
||||
output->m_tx = tx;
|
||||
output->m_amount = amount;
|
||||
output->m_account_index = subaddr_index.major;
|
||||
output->m_subaddress_index = subaddr_index.minor;
|
||||
|
||||
// notify listeners of output
|
||||
for (monero_wallet_listener* listener : m_wallet.get_listeners()) {
|
||||
listener->on_output_received(*output);
|
||||
}
|
||||
|
||||
// free memory
|
||||
output.reset();
|
||||
tx.reset();
|
||||
}
|
||||
|
||||
void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& cn_tx, uint64_t amount, const cryptonote::subaddress_index& subaddr_index, uint64_t unlock_time) {
|
||||
MTRACE("wallet2_listener::on_money_received()");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user