Document why a nested call to ExtractMinerAddress is not recursive
This commit is contained in:
parent
5675a4eed4
commit
8e6927f901
10
src/miner.h
10
src/miner.h
|
@ -51,6 +51,16 @@ public:
|
|||
MinerAddress operator()(const libzcash::UnifiedAddress &addr) const {
|
||||
auto recipient = RecipientForPaymentAddress()(addr);
|
||||
if (recipient) {
|
||||
// This looks like a recursive call, but we are actually calling
|
||||
// ExtractMinerAddress with a different type:
|
||||
// - libzcash::PaymentAddress has a libzcash::UnifiedAddress
|
||||
// alternative, which invokes this method.
|
||||
// - RecipientForPaymentAddress() returns libzcash::RawAddress,
|
||||
// which does not have a libzcash::UnifiedAddress alternative.
|
||||
//
|
||||
// This works because std::visit does not require the visitor to
|
||||
// solely match the std::variant, only that it can handle all of
|
||||
// the variant's alternatives.
|
||||
return std::visit(ExtractMinerAddress(), *recipient);
|
||||
} else {
|
||||
// Either the UA only contains unknown shielded receivers (unlikely that we
|
||||
|
|
Loading…
Reference in New Issue