-
Notifications
You must be signed in to change notification settings - Fork 241
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
Move transaction listening to status-go #4953
Conversation
Jenkins BuildsClick to see older builds (32)
|
c15ce9e
to
3f9325e
Compare
return nil | ||
} | ||
|
||
func (s *Service) handleWalletEvent(event walletevent.Event) { |
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 is the main change in the pr.
Here all events are handled and signal is emitted.
3f9325e
to
6372de1
Compare
EventCommunityTokenTransactionStatusChanged = "communityToken.communityTokenTransactionStatusChanged" | ||
) | ||
|
||
type CommunityTokenTransactionSignal struct { |
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 is signal send to nim.
Is this still WIP? That's still the title 😆 |
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. Just small questions
@@ -64,3 +66,27 @@ func (db *Database) GetCommunityERC20Metadata() ([]*token.CommunityToken, error) | |||
} | |||
return result, rows.Err() | |||
} | |||
|
|||
// duplicated in persistence |
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.
What does this comment mean?
services/communitytokens/service.go
Outdated
GetAssetContractData(chainID uint64, contractAddress string) (*AssetContractData, error) | ||
SafeGetSignerPubKey(ctx context.Context, chainID uint64, communityID string) (string, error) | ||
DeploymentSignatureDigest(chainID uint64, addressFrom string, communityID string) ([]byte, error) | ||
// TODO db operations should be moved to communitytokensdatabase |
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.
Is this TODO still valid?
return nil | ||
} | ||
|
||
func (s *Service) handleWalletEvent(event walletevent.Event) { | ||
if event.Type == transactions.EventPendingTransactionStatusChanged { |
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.
Since we only handle EventPendingTransactionStatusChanged
here, you can reverse the condition and early exit for better readability.
6372de1
to
fe9b825
Compare
transactions.DeployCommunityToken, | ||
transactions.AutoDelete, | ||
transactions.Keep, |
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.
If you change this from Autodelete
to Keep
, you're in charge of calling Delete
to manually remove the entry from the pending_txs table after it fails/succeeds and you do whatever you need with it. I have not seen that though, is it missing or did I miss it?
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.
It is deleted in communitytokens service after handling event.
5d139ac
to
2e94b07
Compare
2e94b07
to
565f8d1
Compare
Use EventWatcher to catch wallet events. Handling all community tokens wallet events in communitytokens service (database and messenger operations). Adding new signal to nim: CommunityTokenTransactionSignal, which is emitted everytime when the event is received. Issue #4351
565f8d1
to
98b7a47
Compare
Use EventWatcher to catch wallet events.
Handling all community tokens wallet events in communitytokens service (database and messenger operations).
Adding new signal to nim: CommunityTokenTransactionSignal, which is emitted everytime when the event is received.
Issue #4351