Zcashd code analysis coins.h


#1

Hi,

In my understanding, to verify if a joinsplit transfer is valid, you just need to check if the nullifiers are distinct and the anchor in the JS description is the root of a valid note commitment tree. These information can be obtained by calling the following functions in coins.h:

bool CCoinsView::GetSproutAnchorAt(const uint256&, SproutMerkleTree&);
bool CCoinsView::GetNullifier(const uint256&, ShieldType);

Therefore, my question is why there are so many other methods in class CCoinsViewCache besides the standard CCoinsView methods.


#2

There are other methods for class CCoinsViewCache because people tend to use them them :tipping_hand_woman:

Sometimes, the standard CCoinsView method doesn’t work when try to use it with the global variables.