-
Notifications
You must be signed in to change notification settings - Fork 143
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
Add BlockChain<T>.UnstageTransactions() #223
Conversation
a741851
to
037ccb3
Compare
Codecov Report
@@ Coverage Diff @@
## master #223 +/- ##
==========================================
- Coverage 84.08% 83.87% -0.22%
==========================================
Files 75 75
Lines 3488 3492 +4
==========================================
- Hits 2933 2929 -4
- Misses 555 563 +8
|
What would this method be used for? |
We need this method to avoid duplicate rewards in games. |
Could you rebase this on the current master? |
037ccb3
to
73ed2d0
Compare
I rebased this on the master branch. @dahlia |
2b79a7b
to
c300520
Compare
Libplanet/Blockchain/BlockChain.cs
Outdated
foreach (Transaction<T> tx in transactions) | ||
{ | ||
Transactions.Remove(tx.Id); | ||
} |
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.
@longfin Should we remove these transactions from pool as well?
This could break things, for example:
Block<Action> b = Block<Action>.Mine(..., transactions: txs);
blockChain.Append(b);
blockChain.UnstageTransactions(txs);
Block<Action> b2 = blockChain.Blocks[b.blockHash]; // This will crash.
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, it can be problem. and, I think that UnstageTransactions()
should remove only staged transactions, not mined transaction.
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.
You're right. So should we make like BlockChain<T>.UnstageTransactionIds()
instead of BlockChain<T>.UnstageTransactions()
?
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.
The current name looks better to me, because it exposes less implementation details.
c300520
to
9b8c5d4
Compare
9b8c5d4
to
256974d
Compare
Bump libplanet
This patch adds
BlockChain<T>.UnstageTransactions()
method.