src/wallet/wallet.cpp
/**
 * Returns a nullifier if the SpendingKey is available
 * Throws std::runtime_error if the decryptor doesn't match this note
 */
Returns a nullifier if the SpendingKey is available
Throws std::runtime_error if the decryptor doesn't match this note
Returns a nullifier if the SpendingKey is available Throws std :: runtime_error if the decryptor doesn ' t match this note
boost::optional<uint256> CWallet::GetSproutNoteNullifier(const JSDescription &jsdesc,
                                                         const libzelcash::SproutPaymentAddress &address,
                                                         const ZCNoteDecryption &dec,
                                                         const uint256 &hSig,
                                                         uint8_t n) const
{
    boost::optional<uint256> ret;
    auto note_pt = libzelcash::SproutNotePlaintext::decrypt(
        dec,
        jsdesc.ciphertexts[n],
        jsdesc.ephemeralKey,
        hSig,
        (unsigned char) n);
    auto note = note_pt.note(address);
    if (note.cm() != jsdesc.commitments[n]) {
        throw libzelcash::note_decryption_failed();
    }
    libzelcash::SproutSpendingKey key;
    if (GetSproutSpendingKey(address, key)) {
        ret = note.nullifier(key);
    }
    return ret;
}
boost :: optional < uint256 > CWallet :: GetSproutNoteNullifier ( const JSDescription & jsdesc , const libzelcash :: SproutPaymentAddress & address , const ZCNoteDecryption & dec , const uint256 & hSig , uint8_t n ) const { boost :: optional < uint256 > ret ; auto note_pt = libzelcash :: SproutNotePlaintext :: decrypt ( dec , jsdesc . ciphertexts [ n ] , jsdesc . ephemeralKey , hSig , ( unsigned char ) n ) ; auto note = note_pt . note ( address ) ; if ( note . cm ( ) != jsdesc . commitments [ n ] ) { throw libzelcash :: note_decryption_failed ( ) ; } libzelcash :: SproutSpendingKey key ; if ( GetSproutSpendingKey ( address , key ) ) { ret = note . nullifier ( key ) ; } return ret ; }
Returns a nullifier if the SpendingKey is available
 Throws std::runtime_error if the decryptor doesn't match this note
Returns a nullifier if the SpendingKey is available Throws std :: runtime_error if the decryptor doesn ' t match this note
// Check note plaintext against note commitment // SpendingKeys are only available if: // - We have them (this isn't a viewing key) // - The wallet is unlocked