-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: improve block height specification for query #101
Conversation
@@ -59,12 +57,6 @@ func (s *PanaceaSubscriber) subscribe(event Event) error { | |||
for tx := range txs { | |||
ctx := context.Background() | |||
|
|||
height, err := strconv.ParseInt(tx.Events["tx.height"][0], 10, 64) |
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.
We no longer take the block height received as an event and use it .
We always use the cached block height.
mutex *sync.Mutex | ||
cdc *codec.ProtoCodec | ||
aminoCdc *codec.AminoCodec | ||
cachedLastBlockHeight int64 |
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 cached block height is managed here.
}, nil | ||
} | ||
|
||
go queryClient.startSchedulingLastBlockCaching() |
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 made some modifications to the existing refresh().
panacea/query_client.go
Outdated
} | ||
return q.GetLastBlockHeight(ctx) | ||
func (q *verifiedQueryClient) getQueryBlockHeight() int64 { | ||
return q.cachedLastBlockHeight - 1 |
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.
Always do -1 in the last block, because the appHash is always in the next block. This is the same as the previous spec.
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.
Thanks, left some comments on some deprecated functions.
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.
lgtm
@audtlr24 @H4NLee @youngjoon-lee |
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.
lgtm
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.
Good
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.
LGTM!
close #100
Implementation