-
Notifications
You must be signed in to change notification settings - Fork 198
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
New notifier #3505
New notifier #3505
Conversation
Codecov Report
@@ Coverage Diff @@
## development #3505 +/- ##
============================================
Coverage 73.87% 73.87%
============================================
Files 582 582
Lines 74521 74532 +11
============================================
+ Hits 55050 55064 +14
+ Misses 15066 15065 -1
+ Partials 4405 4403 -2
Continue to review full report at Codecov.
|
New notifier with finalized block functionality
@@ -84,6 +84,16 @@ func (o *outport) SaveAccounts(blockTimestamp uint64, acc []data.UserAccountHand | |||
} | |||
} | |||
|
|||
// FinalizedBlock will call whenever a block is finalized | |||
func (o *outport) FinalizedBlock(headerHash []byte) { |
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.
will be called / will call all the drivers
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.
done
process/block/baseProcess.go
Outdated
@@ -1087,6 +1087,22 @@ func getLastSelfNotarizedHeaderByItself(chainHandler data.ChainHandler) (data.He | |||
return currentHeader, currentBlockHash | |||
} | |||
|
|||
func (bp *baseProcessor) setFinalizedBlockInIndexer(hdr data.HeaderHandler) { |
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 can remove L1091 - L1099 and change the method parameter to hdrHash []byte as you already have in the caller side the header hash and there is no need to recalculate it here
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.
right
process/block/metablock.go
Outdated
@@ -1392,6 +1392,8 @@ func (mp *metaProcessor) updateState(lastMetaBlock data.HeaderHandler) { | |||
mp.accountsDB[state.PeerAccountsState], | |||
mp.peerStatePruningQueue, | |||
) | |||
|
|||
mp.setFinalizedBlockInIndexer(prevHeader) |
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.
Replace prevHeader with lastMetaBlock.GetPrevHash()
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.
done
process/block/shardblock.go
Outdated
@@ -1044,6 +1044,8 @@ func (sp *shardProcessor) updateState(headers []data.HeaderHandler, currentHeade | |||
sp.accountsDB[state.UserAccountsState], | |||
sp.userStatePruningQueue, | |||
) | |||
|
|||
sp.setFinalizedBlockInIndexer(prevHeader) |
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.
Replace prevHeader with hdr.GetPrevHash()
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.
done
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.
OutportDriver
for theFinalizedBlock
operation.