Skip to content

Add Nonce and ValidUntilBlock to Transaction#765

Merged
erikzhang merged 1 commit intomasterfrom
3.0/tx-struct
May 21, 2019
Merged

Add Nonce and ValidUntilBlock to Transaction#765
erikzhang merged 1 commit intomasterfrom
3.0/tx-struct

Conversation

@erikzhang
Copy link
Copy Markdown
Member

No description provided.

@erikzhang erikzhang added this to the NEO 3.0 milestone May 20, 2019
@codecov-io
Copy link
Copy Markdown

codecov-io commented May 20, 2019

Codecov Report

Merging #765 into master will increase coverage by 0.18%.
The diff coverage is 53.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #765      +/-   ##
==========================================
+ Coverage   32.97%   33.16%   +0.18%     
==========================================
  Files         164      164              
  Lines       11857    11869      +12     
==========================================
+ Hits         3910     3936      +26     
+ Misses       7947     7933      -14
Impacted Files Coverage Δ
neo/Wallets/Wallet.cs 5.92% <0%> (-0.05%) ⬇️
neo/Network/P2P/Payloads/Transaction.cs 61.87% <80%> (+1.4%) ⬆️
neo/Network/P2P/TaskManager.cs 16.75% <0%> (+5.58%) ⬆️
neo/IO/Actors/PriorityMailbox.cs 87.5% <0%> (+12.5%) ⬆️
neo/IO/Actors/PriorityMessageQueue.cs 86.2% <0%> (+24.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2898501...91df88e. Read the comment docs.


public virtual bool Verify(Snapshot snapshot, IEnumerable<Transaction> mempool)
{
if (ValidUntilBlock <= snapshot.Height || ValidUntilBlock > snapshot.Height + MaxValidUntilBlockIncrement)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need to check the second part? ValidUntilBlock > snapshot.Height + MaxValidUntilBlockIncrement

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this we can receive a Transaction and drop it for request again in certains blocks, do you think that is a good check this on Verify?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is reverified at every block anyway.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it the increment when no parameter is passed.
tx.ValidUntilBlock = snapshot.Height + Transaction.MaxValidUntilBlockIncrement

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (tx.ValidUntilBlock == 0)
using (Snapshot snapshot = Blockchain.Singleton.GetSnapshot())
tx.ValidUntilBlock = snapshot.Height + Transaction.MaxValidUntilBlockIncrement;

Copy link
Copy Markdown
Contributor

@igormcoelho igormcoelho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good Erik!
Nonce and Expiration is fundamental without utxo.


public virtual bool Verify(Snapshot snapshot, IEnumerable<Transaction> mempool)
{
if (ValidUntilBlock <= snapshot.Height || ValidUntilBlock > snapshot.Height + MaxValidUntilBlockIncrement)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is reverified at every block anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants