Store v as integer instead of Scalar in NotePlaintext

Co-authored-by: str4d <jack@z.cash>
This commit is contained in:
ying tong 2021-05-28 23:28:01 +08:00 committed by GitHub
parent f44fce557e
commit 70ccff9bd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -126,14 +126,14 @@ class TransmittedNoteCipherText(object):
assert(leadbyte == 2)
np = OrchardNotePlaintext(
p_enc[1:12], # d
Scalar.from_bytes(p_enc[12:20]), # v
struct.unpack('<Q', p_enc[12:20]), # v
p_enc[20:52], # rseed
p_enc[52:564], # memo
)
g_d = diversify_hash(np.d)
pk_d = OrchardKeyAgreement.derive_public(ivk, g_d)
note = OrchardNote(np.d, pk_d, np.v.s, rho, np.rseed)
note = OrchardNote(np.d, pk_d, np.v, rho, np.rseed)
esk = OrchardKeyAgreement.esk(np.rseed, rho)
if OrchardKeyAgreement.derive_public(esk, g_d) != epk:
@ -174,14 +174,14 @@ class TransmittedNoteCipherText(object):
assert(leadbyte == 2)
np = OrchardNotePlaintext(
p_enc[1:12], # d
Scalar.from_bytes(p_enc[12:20]), # v
struct.unpack('<Q', p_enc[12:20]), # v
p_enc[20:52], # rseed
p_enc[52:564], # memo
)
if OrchardKeyAgreement.esk(np.rseed, rho) != esk:
return None
g_d = diversify_hash(np.d)
note = OrchardNote(np.d, pk_d, np.v.s, rho, np.rseed)
note = OrchardNote(np.d, pk_d, np.v, rho, np.rseed)
cm = note.note_commitment()
if cm is None: