src/wallet/wallet.cpp
// Generate a new spending key and return its public payment address
Generate a new spending key and return its public payment address
Generate a new spending key and return its public payment address
libzelcash::SproutPaymentAddress CWallet::GenerateNewSproutZKey()
{
    AssertLockHeld(cs_wallet); 
    auto k = SproutSpendingKey::random();
    auto addr = k.address();
    if (CCryptoKeyStore::HaveSproutSpendingKey(addr))
        throw std::runtime_error("CWallet::GenerateNewSproutZKey(): Collision detected");
    int64_t nCreationTime = GetTime();
    mapSproutZKeyMetadata[addr] = CKeyMetadata(nCreationTime);
    if (!AddSproutZKey(k))
        throw std::runtime_error("CWallet::GenerateNewSproutZKey(): AddSproutZKey failed");
    return addr;
}
libzelcash :: SproutPaymentAddress CWallet :: GenerateNewSproutZKey ( ) { AssertLockHeld ( cs_wallet ) ; auto k = SproutSpendingKey :: random ( ) ; auto addr = k . address ( ) ; if ( CCryptoKeyStore :: HaveSproutSpendingKey ( addr ) ) throw std :: runtime_error ( " " ) ; int64_t nCreationTime = GetTime ( ) ; mapSproutZKeyMetadata [ addr ] = CKeyMetadata ( nCreationTime ) ; if ( ! AddSproutZKey ( k ) ) throw std :: runtime_error ( " " ) ; return addr ; }
Generate a new spending key and return its public payment address
Generate a new spending key and return its public payment address
// mapSproutZKeyMetadata // Check for collision, even though it is unlikely to ever occur // Create new metadata