// Get the debit information of a transaction by index int index = 0; CWalletTx tx; if (GetTransaction(index, tx)) { const CWalletTx::Debit* debit = tx.GetDebit(wallet); if (debit) { // Do something with the debit information } }
// Find a debit object by its hash uint256 tx_hash; CWalletTx tx; if (pwallet->GetTransaction(tx_hash, tx)) { const CWalletTx::Debit* debit = tx.GetDebit(wallet); if (debit) { // Do something with the debit information } }This example retrieves a transaction by its hash using the GetTransaction function and then gets the debit information of that transaction using the GetDebit function. If the function returns a non-null pointer, the debit information can be used in some way. This function belongs to the Bitcoin Core wallet library.