-
Notifications
You must be signed in to change notification settings - Fork 152
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
Cancel mining if blockchain's tip index is changed #517
Conversation
fed45f1
to
88496db
Compare
88496db
to
e277dab
Compare
Tests in several environments failed due to timeout. |
54d44a1
to
512f5bf
Compare
Codecov Report
@@ Coverage Diff @@
## master #517 +/- ##
==========================================
+ Coverage 90.3% 90.32% +0.02%
==========================================
Files 201 201
Lines 14928 15013 +85
==========================================
+ Hits 13481 13561 +80
- Misses 1170 1174 +4
- Partials 277 278 +1
|
Assert.Throws<InvalidBlockIndexException>(() => _blockChain.Append(block)); | ||
Assert.False(called); | ||
|
||
// TODO: Add test cases for swap |
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.
It would be good to have an issue for this.
512f5bf
to
afa139d
Compare
afa139d
to
9494bee
Compare
c48869d
to
5184241
Compare
Libplanet/Blockchain/BlockChain.cs
Outdated
throw new OperationCanceledException( | ||
"Mining canceled due to change of tip index"); | ||
} | ||
else |
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.
How about just re-throw it?
else | |
throw; |
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.
I used TaskCanceledException
here because other tasks used in Swarm<T>
throw TaskCanceledException
when cancel is requested.
5184241
to
838655e
Compare
838655e
to
bf8de58
Compare
This patch implements and closes #460. Some XML descriptions and test cases are included in this PR.