Merge pull request #10587 from filecoin-project/10583-enable-index-for-statewaitformessage

feat: Use MessageIndex in WaitForMessage
This commit is contained in:
Friðrik Ásmundsson 2023-03-29 18:38:39 +02:00 committed by GitHub
commit 36913db0cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,10 +57,15 @@ func (sm *StateManager) WaitForMessage(ctx context.Context, mcid cid.Cid, confid
var backFm cid.Cid var backFm cid.Cid
backSearchWait := make(chan struct{}) backSearchWait := make(chan struct{})
go func() { go func() {
fts, r, foundMsg, err := sm.searchBackForMsg(ctx, head[0].Val, msg, lookbackLimit, allowReplaced) fts, r, foundMsg, err := sm.searchForIndexedMsg(ctx, mcid, msg)
if err != nil {
log.Warnf("failed to look back through chain for message: %v", err) found := (err == nil && r != nil && foundMsg.Defined())
return if !found {
fts, r, foundMsg, err = sm.searchBackForMsg(ctx, head[0].Val, msg, lookbackLimit, allowReplaced)
if err != nil {
log.Warnf("failed to look back through chain for message: %v", err)
return
}
} }
backTs = fts backTs = fts