Merge pull request #4595 from GFZRZK/GFZRZK/bugfix/fix_workerkey_error_in_wdpost_setsender

worker key should change when set sender found key not equal with the value on chain
This commit is contained in:
Łukasz Magiera 2020-10-26 14:55:48 +01:00 committed by GitHub
commit 1afd3a41cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -759,6 +759,18 @@ func (s *WindowPoStScheduler) setSender(ctx context.Context, msg *types.Message,
msg.From = s.worker
return
}
worker, err := s.api.StateAccountKey(ctx, mi.Worker, types.EmptyTSK)
if err != nil {
log.Errorw("error getting account key", "error", err)
msg.From = s.worker
return
}
// worker should keep sync with state on chain, if not, will met error when estimate msg gas.
if s.worker != worker {
s.worker = worker
msg.From = s.worker
}
gm, err := s.api.GasEstimateMessageGas(ctx, msg, spec, types.EmptyTSK)
if err != nil {