Add Orchard to change address generation
This commit is contained in:
parent
d4eee99060
commit
d49c8a2865
|
@ -1901,6 +1901,9 @@ std::optional<RecipientAddress> CWallet::GenerateChangeAddressForAccount(
|
|||
for (OutputPool t : changeOptions) {
|
||||
std::optional<RecipientAddress> changeAddr;
|
||||
switch (t) {
|
||||
case OutputPool::Orchard:
|
||||
changeAddr = ufvk.value().GetChangeAddress(OrchardChangeRequest());
|
||||
break;
|
||||
case OutputPool::Sapling:
|
||||
changeAddr = ufvk.value().GetChangeAddress(SaplingChangeRequest());
|
||||
break;
|
||||
|
|
|
@ -43,6 +43,10 @@ uint256 OrchardFullViewingKey::ToInternalOutgoingViewingKey() const {
|
|||
return ovk;
|
||||
}
|
||||
|
||||
OrchardRawAddress OrchardFullViewingKey::GetChangeAddress() const {
|
||||
return ToInternalIncomingViewingKey().Address(0);
|
||||
}
|
||||
|
||||
OrchardSpendingKey OrchardSpendingKey::ForAccount(
|
||||
const HDSeed& seed,
|
||||
uint32_t bip44CoinType,
|
||||
|
|
|
@ -206,6 +206,8 @@ public:
|
|||
|
||||
uint256 ToInternalOutgoingViewingKey() const;
|
||||
|
||||
libzcash::OrchardRawAddress GetChangeAddress() const;
|
||||
|
||||
OrchardFullViewingKey& operator=(OrchardFullViewingKey&& key)
|
||||
{
|
||||
if (this != &key) {
|
||||
|
|
|
@ -175,16 +175,23 @@ std::optional<RecipientAddress> ZcashdUnifiedFullViewingKey::GetChangeAddress(co
|
|||
}
|
||||
},
|
||||
[&](const SaplingChangeRequest& req) {
|
||||
// currently true by construction, as a UFVK must have a supported shielded component
|
||||
if (saplingKey.has_value()) {
|
||||
addr = saplingKey.value().GetChangeAddress();
|
||||
}
|
||||
},
|
||||
[&](const OrchardChangeRequest& req) {
|
||||
if (orchardKey.has_value()) {
|
||||
addr = orchardKey.value().GetChangeAddress();
|
||||
}
|
||||
}
|
||||
}, req);
|
||||
return addr;
|
||||
}
|
||||
|
||||
std::optional<RecipientAddress> ZcashdUnifiedFullViewingKey::GetChangeAddress() const {
|
||||
if (orchardKey.has_value()) {
|
||||
return orchardKey.value().GetChangeAddress();
|
||||
}
|
||||
if (saplingKey.has_value()) {
|
||||
return saplingKey.value().GetChangeAddress();
|
||||
}
|
||||
|
|
|
@ -58,10 +58,12 @@ public:
|
|||
};
|
||||
|
||||
class SaplingChangeRequest {};
|
||||
class OrchardChangeRequest {};
|
||||
|
||||
typedef std::variant<
|
||||
TransparentChangeRequest,
|
||||
SaplingChangeRequest> ChangeRequest;
|
||||
SaplingChangeRequest,
|
||||
OrchardChangeRequest> ChangeRequest;
|
||||
|
||||
/**
|
||||
* Test whether the specified list of receiver types contains a
|
||||
|
|
Loading…
Reference in New Issue