Skip to content
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

🐛 Fix duplicated key issue #801

Merged
merged 1 commit into from
Nov 23, 2022
Merged

🐛 Fix duplicated key issue #801

merged 1 commit into from
Nov 23, 2022

Conversation

WeiJun0827
Copy link
Contributor

Since we may have mint_nft and new_class events in the same Tx.
The key should be multiple fields.

@nwingt nwingt merged commit 321d85f into likecoin:master Nov 23, 2022
Copy link
Member

@williamchong williamchong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what case do we have mint_nft and new_class in a same transaction? It sounds impossible since we don't have a class_id for mint_nft if new_class is not passed as a transaction first..

@@ -371,10 +371,10 @@ export default {
const historyInDB = data.list;
const eventMap = new Map();
historyOnChain.forEach(e => {
eventMap.set(`${e.txHash}-${e.nftId}`, e);
eventMap.set(`${e.txHash}-${e.nftId}-${e.event}`, e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to key each event, or do we just want message keys?
If its just message maybe msg_index will do

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the key would be {txHash}-{msgIndex}?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what case do we have mint_nft and new_class in a same transaction? It sounds impossible since we don't have a class_id for mint_nft if new_class is not passed as a transaction first..

Sorry for typo, should be mint_nft and /cosmos.nft.v1beta1.MsgSend, not new_class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I looked again and the event api only returns event name not msg_index
So current event key is good

@WeiJun0827 WeiJun0827 deleted the fix/duplicated-key branch November 24, 2022 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants