Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Resync pending state if needed before adding new transactions #4520

Merged
merged 1 commit into from
Sep 21, 2017

Conversation

gumb0
Copy link
Member

@gumb0 gumb0 commented Sep 19, 2017

This should fix the assert happening during sync:
https://github.com/ethereum/cpp-ethereum/blob/develop/libethereum/Block.cpp#L326

It happened when m_working in Client is not up-to-date with the latest modifications to BlockChain and then we tried to import new transactions from TransactionQueue

@@ -659,7 +658,7 @@ void Client::doWork(bool _doWait)
bool isSealed = false;
DEV_READ_GUARDED(x_working)
isSealed = m_working.isSealed();
if (!isSealed && !isSyncing() && !m_remoteWorking && m_syncTransactionQueue.compare_exchange_strong(t, false))
Copy link
Member Author

Choose a reason for hiding this comment

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

This will make processing of pending transactions to start closer to sync finish.
(isSyncing() returns false when there are no more blocks to download, but there still may be many blocks to import in BlockQueue)

@gumb0
Copy link
Member Author

gumb0 commented Sep 19, 2017

Wait, this leads to deadlock

@gumb0 gumb0 removed the request for review from chfast September 19, 2017 13:37
@codecov-io
Copy link

codecov-io commented Sep 19, 2017

Codecov Report

Merging #4520 into develop will increase coverage by 0.09%.
The diff coverage is 17.85%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4520      +/-   ##
===========================================
+ Coverage    63.15%   63.25%   +0.09%     
===========================================
  Files          364      364              
  Lines        30413    30423      +10     
  Branches      2750     2752       +2     
===========================================
+ Hits         19208    19243      +35     
+ Misses       11022    10996      -26     
- Partials       183      184       +1
Impacted Files Coverage Δ
libethereum/Client.cpp 26.75% <17.85%> (+1.18%) ⬆️
test/tools/jsontests/StateTests.cpp 91.26% <0%> (+0.26%) ⬆️
libethereum/EthereumHost.cpp 9.89% <0%> (+0.27%) ⬆️
test/unittests/libweb3jsonrpc/Client.cpp 32.61% <0%> (+0.65%) ⬆️
libethereum/BlockQueue.h 71.6% <0%> (+1.23%) ⬆️
libethereum/BlockChainSync.cpp 7.51% <0%> (+1.34%) ⬆️
test/unittests/libethereum/BlockQueue.cpp 51.66% <0%> (+1.47%) ⬆️
libethereum/BlockChainSync.h 18.18% <0%> (+9.09%) ⬆️
libethereum/VerifiedBlock.h 93.75% <0%> (+25%) ⬆️
... and 1 more

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 8d58cb3...f5b3ddc. Read the comment docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants