CSerializeRecipientAddress: add Read method and make constructor private.
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
This commit is contained in:
parent
99a69182cd
commit
108e9d4658
|
@ -858,10 +858,9 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|||
else if (strType == "recipientmapping")
|
||||
{
|
||||
uint256 txid;
|
||||
CSerializeRecipientAddress recipient;
|
||||
std::string rawUa;
|
||||
ssKey >> txid;
|
||||
ssKey >> recipient;
|
||||
auto recipient = CSerializeRecipientAddress::Read(ssKey);
|
||||
ssValue >> rawUa;
|
||||
|
||||
auto ua = libzcash::UnifiedAddress::Parse(Params(), rawUa);
|
||||
|
@ -875,7 +874,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|||
[&](const CKeyID& key) { recipientReceiver = key; },
|
||||
[&](const CScriptID& scriptId) { recipientReceiver = scriptId; },
|
||||
[&](const libzcash::SaplingPaymentAddress& addr) { recipientReceiver = addr; }
|
||||
}, recipient.recipient);
|
||||
}, recipient);
|
||||
|
||||
bool found = false;
|
||||
for (const auto& receiver : ua.value().GetReceiversAsParsed()) {
|
||||
|
|
|
@ -318,11 +318,11 @@ public:
|
|||
// as a pair of typecode and address bytes, similar to how unified address
|
||||
// receivers are written (but excluding the unknown receiver case)
|
||||
class CSerializeRecipientAddress {
|
||||
libzcash::RecipientAddress recipient;
|
||||
libzcash::ReceiverType typecode;
|
||||
CSerializeRecipientAddress() {} // for serialization only
|
||||
|
||||
public:
|
||||
libzcash::RecipientAddress recipient;
|
||||
CSerializeRecipientAddress() {} // for serialization only
|
||||
CSerializeRecipientAddress(libzcash::RecipientAddress recipient): recipient(recipient) {}
|
||||
|
||||
template<typename Stream>
|
||||
|
@ -369,6 +369,13 @@ class CSerializeRecipientAddress {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Stream>
|
||||
static libzcash::RecipientAddress Read(Stream& stream) {
|
||||
CSerializeRecipientAddress csr;
|
||||
stream >> csr;
|
||||
return csr.recipient;
|
||||
}
|
||||
};
|
||||
|
||||
/** Access to the wallet database */
|
||||
|
|
Loading…
Reference in New Issue