wallet: Add HaveSpendingKeyForPaymentAddress visitor
This commit is contained in:
@@ -4374,6 +4374,26 @@ bool PaymentAddressBelongsToWallet::operator()(const libzcash::InvalidEncoding&
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HaveSpendingKeyForPaymentAddress::operator()(const libzcash::SproutPaymentAddress &zaddr) const
|
||||||
|
{
|
||||||
|
return m_wallet->HaveSproutSpendingKey(zaddr);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HaveSpendingKeyForPaymentAddress::operator()(const libzcash::SaplingPaymentAddress &zaddr) const
|
||||||
|
{
|
||||||
|
libzcash::SaplingIncomingViewingKey ivk;
|
||||||
|
libzcash::SaplingFullViewingKey fvk;
|
||||||
|
|
||||||
|
return m_wallet->GetSaplingIncomingViewingKey(zaddr, ivk) &&
|
||||||
|
m_wallet->GetSaplingFullViewingKey(ivk, fvk) &&
|
||||||
|
m_wallet->HaveSaplingSpendingKey(fvk);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HaveSpendingKeyForPaymentAddress::operator()(const libzcash::InvalidEncoding& no) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
boost::optional<libzcash::SpendingKey> GetSpendingKeyForPaymentAddress::operator()(
|
boost::optional<libzcash::SpendingKey> GetSpendingKeyForPaymentAddress::operator()(
|
||||||
const libzcash::SproutPaymentAddress &zaddr) const
|
const libzcash::SproutPaymentAddress &zaddr) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1319,6 +1319,18 @@ public:
|
|||||||
bool operator()(const libzcash::InvalidEncoding& no) const;
|
bool operator()(const libzcash::InvalidEncoding& no) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class HaveSpendingKeyForPaymentAddress : public boost::static_visitor<bool>
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
CWallet *m_wallet;
|
||||||
|
public:
|
||||||
|
HaveSpendingKeyForPaymentAddress(CWallet *wallet) : m_wallet(wallet) {}
|
||||||
|
|
||||||
|
bool operator()(const libzcash::SproutPaymentAddress &zaddr) const;
|
||||||
|
bool operator()(const libzcash::SaplingPaymentAddress &zaddr) const;
|
||||||
|
bool operator()(const libzcash::InvalidEncoding& no) const;
|
||||||
|
};
|
||||||
|
|
||||||
class GetSpendingKeyForPaymentAddress : public boost::static_visitor<boost::optional<libzcash::SpendingKey>>
|
class GetSpendingKeyForPaymentAddress : public boost::static_visitor<boost::optional<libzcash::SpendingKey>>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user