bitcoin/BRWallet.c
// writes all addresses previously genereated with BRWalletUnusedAddrs() to addrs
// returns the number addresses written, or total number available if addrs is NULL
writes all addresses previously genereated with BRWalletUnusedAddrs() to addrs
returns the number addresses written, or total number available if addrs is NULL
writes all addresses previously genereated with BRWalletUnusedAddrs () to addrs returns the number addresses written or total number available if addrs is NULL
size_t BRWalletAllAddrs(BRWallet *wallet, BRAddress addrs[], size_t addrsCount)
{
    size_t i, internalCount = 0, externalCount = 0;
    assert(wallet != NULL);
    pthread_mutex_lock(&wallet->lock);
    internalCount = (! addrs || array_count(wallet->internalChain) < addrsCount) ?
                    array_count(wallet->internalChain) : addrsCount;
    for (i = 0; addrs && i < internalCount; i++) {
        BRAddressFromHash160(addrs[i].s, sizeof(*addrs), wallet->addrParams, &wallet->internalChain[i]);
    }
    externalCount = (! addrs || array_count(wallet->externalChain) < addrsCount - internalCount) ?
                    array_count(wallet->externalChain) : addrsCount - internalCount;
    for (i = 0; addrs && i < externalCount; i++) {
        BRAddressFromHash160(addrs[internalCount + i].s, sizeof(*addrs), wallet->addrParams, &wallet->externalChain[i]);
    }
    pthread_mutex_unlock(&wallet->lock);
    return internalCount + externalCount;
}
size_t BRWalletAllAddrs ( BRWallet * wallet , BRAddress addrs [ ] , size_t addrsCount ) { size_t i , internalCount = 0 , externalCount = 0 ; assert ( wallet != NULL ) ; pthread_mutex_lock ( & wallet -> lock ) ; internalCount = ( ! addrs || array_count ( wallet -> internalChain ) < addrsCount ) ? array_count ( wallet -> internalChain ) : addrsCount ; for ( i = 0 ; addrs && i < internalCount ; i ++ ) { BRAddressFromHash160 ( addrs [ i ] . s , sizeof ( * addrs ) , wallet -> addrParams , & wallet -> internalChain [ i ] ) ; } externalCount = ( ! addrs || array_count ( wallet -> externalChain ) < addrsCount - internalCount ) ? array_count ( wallet -> externalChain ) : addrsCount - internalCount ; for ( i = 0 ; addrs && i < externalCount ; i ++ ) { BRAddressFromHash160 ( addrs [ internalCount + i ] . s , sizeof ( * addrs ) , wallet -> addrParams , & wallet -> externalChain [ i ] ) ; } pthread_mutex_unlock ( & wallet -> lock ) ; return internalCount + externalCount ; }
writes all addresses previously genereated with BRWalletUnusedAddrs() to addrs
returns the number addresses written, or total number available if addrs is NULL
writes all addresses previously genereated with BRWalletUnusedAddrs () to addrs returns the number addresses written or total number available if addrs is NULL