-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add timestampMs
for transactions
#93
base: dev
Are you sure you want to change the base?
Conversation
@@ -476,6 +479,10 @@ Transaction.prototype.verify = function (trs, sender, requester, cb) { | |||
return setImmediate(cb, 'Missing sender'); | |||
} | |||
|
|||
if (typeof trs.timestampMs !== 'number') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will previous txs/blocks be valid?
It's important to keep backward compatibility.
@@ -647,10 +654,26 @@ Transaction.prototype.verify = function (trs, sender, requester, cb) { | |||
if (trs.timestamp < INT_32_MIN || trs.timestamp > INT_32_MAX) { | |||
return setImmediate(cb, 'Invalid transaction timestamp. Timestamp is not in the int32 range'); | |||
} | |||
if (slots.getSlotNumber(trs.timestamp) > slots.getSlotNumber()) { | |||
|
|||
if (Math.abs(trs.timestampMs - trs.timestamp * 1000) >= 1000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will previous txs/blocks be valid?
return setImmediate(cb, 'Invalid transaction timestamp. Timestamp and timestampMs delta is greater than 1000ms'); | ||
} | ||
|
||
const currentTime = slots.getTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns time in seconds, not in ms, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
Ensure that
|
https://trello.com/c/IN62zyEb/114-feat-verify-store-and-return-unixtimestamp-for-txs