SIGBlockchain / project_aurum

SIG Blockchain blockchain project in Go
https://acm.cs.uic.edu/sigblockchain
MIT License
7 stars 1 forks source link

Validate Producer Timestamp #373

Closed HarryL5004 closed 4 years ago

HarryL5004 commented 4 years ago

Package context: internal/validation Branch: validate_Block

For this issue, add code to the ValidateProducerTimestamp function stub that checks the timestamp (pT) in the parameter with the timestamp (wT) in the producer table corresponding to the wallet address and the interval (itv).

Return false if the parameter timestamp is less than the sum of the table timestamp and the interval. pT < wT + itv

Useful Resources:

arosso3 commented 4 years ago

Where can I find the column labels for the producer table?

HarryL5004 commented 4 years ago

The columns for the producer table are: (public_key_hash TEXT PRIMARY KEY, timestamp INTEGER)

You can find the column labels in sqlstatements where it says CREATE_PRODUCER_TABLE.

arosso3 commented 4 years ago

Are the timestamps and interval both in nanoseconds? Because if so the interval is always to large for the condition pT < wT + itv to ever be false

HarryL5004 commented 4 years ago

Sorry for the late response. I updated the unit test so that pT is now possible to be greater than or equal to wT + itv.