Add newly discovered sapling addresses to the wallet

This commit is contained in:
Eirik Ogilvie-Wigley
2018-10-01 09:34:25 -06:00
parent 83c4e360da
commit a4ecd0fa72
5 changed files with 46 additions and 16 deletions

View File

@@ -156,9 +156,21 @@ bool CBasicKeyStore::AddSaplingFullViewingKey(
LOCK(cs_SpendingKeyStore);
auto ivk = fvk.in_viewing_key();
mapSaplingFullViewingKeys[ivk] = fvk;
// Add defaultAddr -> SaplingIncomingViewing to SaplingIncomingViewingKeyMap
mapSaplingIncomingViewingKeys[defaultAddr] = ivk;
return AddSaplingIncomingViewingKey(ivk, defaultAddr);
}
// This function updates the wallet's internal address->ivk map.
// If we add an address that is already in the map, the map will
// remain unchanged as each address only has one ivk.
bool CBasicKeyStore::AddSaplingIncomingViewingKey(
const libzcash::SaplingIncomingViewingKey &ivk,
const libzcash::SaplingPaymentAddress &addr)
{
LOCK(cs_SpendingKeyStore);
// Add addr -> SaplingIncomingViewing to SaplingIncomingViewingKeyMap
mapSaplingIncomingViewingKeys[addr] = ivk;
return true;
}