worker key should change when set sender found key not equal with the value on chain

This commit is contained in:
wangchao 2020-10-26 14:52:42 +08:00
parent d4cdc6d334
commit e65aa4cf17

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 {