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

optimize LoadTipSetMessage / 优化LoadTipSetMessage #6118

Merged
merged 3 commits into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions pkg/chain/message_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,35 @@ func (ms *MessageStore) LoadTipSetMessage(ctx context.Context, ts *types.TipSet)
return nil, errors.Errorf("failed to load state tree")
}

useIds := false
selectMsg := func(m *types.Message) (bool, error) {
var sender address.Address
if ts.Height() >= ms.fkCfg.UpgradeHyperdriveHeight {
sender, err = st.LookupID(m.From)
if err != nil {
return false, err
if useIds {
sender, err = st.LookupID(m.From)
if err != nil {
return false, fmt.Errorf("failed to resolve sender: %w", err)
}
} else {
if m.From.Protocol() != address.ID {
// we haven't been told to use IDs, just use the robust addr
sender = m.From
} else {
// uh-oh, we actually have an ID-sender!
useIds = true
for robust, nonce := range applied {
resolved, err := st.LookupID(robust)
if err != nil {
return false, fmt.Errorf("failed to resolve sender: %w", err)
}
applied[resolved] = nonce
}

sender, err = st.LookupID(m.From)
if err != nil {
return false, fmt.Errorf("failed to resolve sender: %w", err)
}
}
}
} else {
sender = m.From
Expand Down
Loading