bitcoin/BRWalletManager.c
/**
 * These callbacks come from the BRWallet. That component has no inherent thread mode of its own. As
 * such, these callbacks can occur on any thread. That includes that of the caller that
 * triggered the callback, as well as the threads created for each BRPeer created by the
 * BRPeerManager (by way of the BRSyncManager).
 *
 * As an example, `BRWalletUpdateTransactions` is called by `_peerRelayedBlock`. That
 * `_peerRelayedBlock` function holds the BRPeerManager's lock and `BRWalletUpdateTransactions`
 * will call into `_BRWalletManagerTxUpdated`. If we were to acquire the BRWalletManager::lock
 * in `_BRWalletManagerTxUpdated`, we would have a lock inversion situation (the lock flow
 * should ONLY be BRWalletManager::lock -> BRPeerManager::lock, NEVER BRPeerManager::lock
 * -> BRWalletManager::lock).
 *
 * It is hypothesized that the other callbacks can occur way, via the BRPeerManager. Thus
 * these callbacks avoid taking the BRWalletManager::lock, to be safe.
 *
 * !!!! These callbacks do NOT (and should NEVER) acquire the BRWalletManager::lock. !!!!
 */
These callbacks come from the BRWallet. That component has no inherent thread mode of its own. As
such, these callbacks can occur on any thread. That includes that of the caller that
triggered the callback, as well as the threads created for each BRPeer created by the
BRPeerManager (by way of the BRSyncManager).

As an example, `BRWalletUpdateTransactions` is called by `_peerRelayedBlock`.

It is hypothesized that the other callbacks can occur way, via the BRPeerManager. Thus
these callbacks avoid taking the BRWalletManager::lock, to be safe.

These callbacks do NOT (and should NEVER) acquire the BRWalletManager::lock.
These callbacks come from the BRWallet . That component has no inherent thread mode of its own . As such these callbacks can occur on any thread . That includes that of the caller that triggered the callback as well as the threads created for each BRPeer created by the BRPeerManager ( by way of the BRSyncManager ) . As an example ` BRWalletUpdateTransactions ` is called by ` _peerRelayedBlock ` . It is hypothesized that the other callbacks can occur way via the BRPeerManager . Thus these callbacks avoid taking the BRWalletManager :: lock to be safe . These callbacks do NOT ( and should NEVER ) acquire the BRWalletManager :: lock .
static void
_BRWalletManagerBalanceChanged (void *info,
                                uint64_t balanceInSatoshi) {
    BRWalletManager manager = (BRWalletManager) info;
    bwmSignalWalletEvent(manager,
                         manager->wallet,
                         (BRWalletEvent) {
                             BITCOIN_WALLET_BALANCE_UPDATED,
                             { .balance = { balanceInSatoshi }}
                         });
}
static void _BRWalletManagerBalanceChanged ( void * info , uint64_t balanceInSatoshi ) { BRWalletManager manager = ( BRWalletManager ) info ; bwmSignalWalletEvent ( manager , manager -> wallet , ( BRWalletEvent ) { BITCOIN_WALLET_BALANCE_UPDATED , { . balance = { balanceInSatoshi } } } ) ; }
These callbacks come from the BRWallet.
These callbacks come from the BRWallet .