-
Notifications
You must be signed in to change notification settings - Fork 699
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
Store txs in block (write part) #4023
base: feature-3.6.0
Are you sure you want to change the base?
Store txs in block (write part) #4023
Conversation
61357e6
to
3bbb960
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## feature-3.6.0 #4023 +/- ##
==================================================
+ Coverage 0 63.05% +63.05%
==================================================
Files 0 1040 +1040
Lines 0 88037 +88037
Branches 0 28378 +28378
==================================================
+ Hits 0 55516 +55516
- Misses 0 31455 +31455
- Partials 0 1066 +1066 ☔ View full report in Codecov by Sentry. |
36c64af
to
a2dfae7
Compare
01a1477
to
f31fa45
Compare
f31fa45
to
2d05832
Compare
09420d8
to
9cec0ac
Compare
44ce74d
to
5a4fc58
Compare
0f815f3
to
19675ad
Compare
If this modification decreases the performance, we need a way to rollback fast, so add a switch of the feature |
bcos-ledger/src/libledger/Ledger.cpp
Outdated
// if blockVersion >= 3.6, txs will be stored when commit block, not here | ||
if (blockVersion >= uint32_t(bcos::protocol::BlockVersion::V3_6_VERSION)) | ||
{ | ||
--TOTAL_CALLBACK; |
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.
--TOTAL_CALLBACK; | |
TOTAL_CALLBACK = 7; |
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.
why TOTAL_CALLBACK = 7
, i think should be TOTAL_CALLBACK = 8
[txpool, block]() { txpool->storeVerifiedBlock(block); }); | ||
} | ||
|
||
// Note: To avoid incomplete transactions in the block, the block is only stored once during commit |
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.
this should not be comment, is necessary for consensus
bcos-ledger/src/libledger/Ledger.cpp
Outdated
txHashes.push_back(concepts::bytebuffer::toView((*txsToStoreHash)[unstoredTxsCount])); | ||
|
||
numberAndTxid[unstoredTxsCount] = | ||
blockNumberStr + "+" + boost::lexical_cast<std::string>(unstoredTxsCount); |
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.
blockNumberStr + "+" + boost::lexical_cast<std::string>(unstoredTxsCount); | |
blockNumberStr + "_" + boost::lexical_cast<std::string>(unstoredTxsCount); |
bcos-ledger/src/libledger/Ledger.cpp
Outdated
bcos::protocol::Transaction::Ptr txData; | ||
if (blockNumber == SYS_CONTRACT_DEPLOY_NUMBER) | ||
{ | ||
txData = m_blockFactory->transactionFactory()->createTransaction( |
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 left doesn't have this logic? can you explain why we need this?
bcos-ledger/src/libledger/Ledger.cpp
Outdated
else | ||
{ | ||
txData = | ||
m_blockFactory->transactionFactory()->createTransaction(bcos::ref(encodeData)); |
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.
tx is a transaction pointer, why encode and then decode?
1dd84db
to
b484afa
Compare
Add new tables to store txs:
SYS_NUMBER_2_BLOCK_TXS block number -> txs data (for storing txs in block)
SYS_TXHASH_2_NUMBER tx hash -> block number + index (for getTxByTxHash)