From e65aa4cf17dac869440cb908df9c28e61ba8a044 Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 26 Oct 2020 14:52:42 +0800 Subject: [PATCH] worker key should change when set sender found key not equal with the value on chain --- storage/wdpost_run.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/storage/wdpost_run.go b/storage/wdpost_run.go index fd3053a34..f456ff68d 100644 --- a/storage/wdpost_run.go +++ b/storage/wdpost_run.go @@ -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 {