-
Notifications
You must be signed in to change notification settings - Fork 15
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 BlockTransaction.Index and BlockOperation.Index #765
base: master
Are you sure you want to change the base?
Conversation
|
8059cb9
to
9940a20
Compare
Codecov Report
@@ Coverage Diff @@
## master #765 +/- ##
========================================
- Coverage 60.49% 60.3% -0.2%
========================================
Files 153 156 +3
Lines 10708 10859 +151
========================================
+ Hits 6478 6548 +70
- Misses 3498 3572 +74
- Partials 732 739 +7
Continue to review full report at Codecov.
|
As you can see here Lines 51 to 53 in 820e28d
To overcome this, As-is implementation uses the combination of TxHash and OpHash for unique ID of BlockOperation. Different from others such as In conclusion, therefore, if this PR support index key as a combination of the sequence number of @anarcher What do you think about this? |
@kfangw IMHO, the With #767 , My original idea is to use Tx.Index and Op.Index for ordering part for cursor (not prefixing part). |
ebc76ca
to
de2a37d
Compare
@outsideris @kfangw Thanks for kindly discuss. I feel that I understand this |
|
7f935b2
to
378f89f
Compare
What do you think about it? @spikeekips @kfangw @Charleslee522 |
Body []byte `json:"body"` | ||
Height uint64 `json:"block_height"` | ||
Index uint64 `json:"index"` | ||
TxIndex uint64 `json:"tx_index"` |
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 does the BlockOperation
store the tx index ?
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 think that total order of operation is height-txindex-opindex
. So..
So far, so good. |
be9f1d4
to
de8f5ac
Compare
5baf707
to
92634ee
Compare
I almost finished this PR.... 💤 |
I finished it. plz review it.... |
- For building blockoperation's indexes, tx.Index is needed.
2a384b8
to
522e52d
Compare
I revert |
How about this interface?
|
Github Issue
Background
Like
Block.Height
,BlockTransaction
andBlockOperation
can have their own ordered index.The advantage of the indexes is that 1) make readable ordering for DB index and cursor, 2) we can easily realize like that the Second op of 21 tx of 1202 height.. and all nodes have same indexes.
Background: All nodes have the same indexes if nodes have the same hash.
Solution
BlockTransaction
andBlockOperation
api/resource/BlockTransaction
andapi/resource/BlockOperation
prev
andnext
using one more thing....Possible Drawbacks