diff --git a/pkg/chain/message_store.go b/pkg/chain/message_store.go index 16dd73f14a..179fc5cb2c 100644 --- a/pkg/chain/message_store.go +++ b/pkg/chain/message_store.go @@ -386,13 +386,37 @@ 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 }