Change default_address to return SaplingPaymentAddr and not boost::optional
This commit is contained in:
@@ -103,21 +103,16 @@ libzcash::PaymentAddress CWallet::GenerateNewZKey()
|
||||
// Generate a new Sapling spending key and return its public payment address
|
||||
SaplingPaymentAddress CWallet::GenerateNewSaplingZKey()
|
||||
{
|
||||
AssertLockHeld(cs_wallet); // mapZKeyMetadata
|
||||
AssertLockHeld(cs_wallet); // mapSaplingZKeyMetadata
|
||||
|
||||
SaplingSpendingKey sk;
|
||||
boost::optional<SaplingPaymentAddress> addrOpt;
|
||||
while (!addrOpt){
|
||||
sk = SaplingSpendingKey::random();
|
||||
addrOpt = sk.default_address();
|
||||
}
|
||||
|
||||
auto addr = addrOpt.value();
|
||||
auto sk = SaplingSpendingKey::random();
|
||||
auto fvk = sk.full_viewing_key();
|
||||
auto addr = sk.default_address();
|
||||
|
||||
// Check for collision, even though it is unlikely to ever occur
|
||||
if (CCryptoKeyStore::HaveSaplingSpendingKey(fvk))
|
||||
throw std::runtime_error("CWallet::GenerateNewSaplingZKey(): Collision detected");
|
||||
if (CCryptoKeyStore::HaveSaplingSpendingKey(fvk)) {
|
||||
throw std::runtime_error("CWallet::GenerateNewSaplingZKey(): Collision detected");
|
||||
}
|
||||
|
||||
// Create new metadata
|
||||
int64_t nCreationTime = GetTime();
|
||||
|
||||
Reference in New Issue
Block a user