Add test for GetNoteDecryptor()
This commit is contained in:
@@ -27,3 +27,15 @@ TEST(keystore_tests, store_and_retrieve_spending_key) {
|
|||||||
EXPECT_EQ(1, addrs.size());
|
EXPECT_EQ(1, addrs.size());
|
||||||
EXPECT_EQ(1, addrs.count(addr));
|
EXPECT_EQ(1, addrs.count(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(keystore_tests, store_and_retrieve_note_decryptor) {
|
||||||
|
CBasicKeyStore keyStore;
|
||||||
|
ZCNoteDecryption decOut;
|
||||||
|
|
||||||
|
auto sk = libzcash::SpendingKey::random();
|
||||||
|
auto addr = sk.address();
|
||||||
|
keyStore.AddSpendingKey(sk);
|
||||||
|
|
||||||
|
keyStore.GetNoteDecryptor(addr, decOut);
|
||||||
|
EXPECT_EQ(ZCNoteDecryption(sk.viewing_key()), decOut);
|
||||||
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ public:
|
|||||||
unsigned char nonce
|
unsigned char nonce
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
friend inline bool operator==(const NoteDecryption& a, const NoteDecryption& b) { return a.sk_enc == b.sk_enc && a.pk_enc == b.pk_enc; }
|
||||||
friend inline bool operator<(const NoteDecryption& a, const NoteDecryption& b) { return a.pk_enc < b.pk_enc; }
|
friend inline bool operator<(const NoteDecryption& a, const NoteDecryption& b) { return a.pk_enc < b.pk_enc; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user