Use MessagePrototype for check API

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera
2021-05-07 15:30:05 +02:00
parent 3d8f641310
commit 8d75da1629
9 changed files with 43 additions and 38 deletions
+1 -10
View File
@@ -114,17 +114,8 @@ type CheckInfo struct {
var ErrCheckFailed = fmt.Errorf("check has failed")
func (s *ServicesImpl) RunChecksForPrototype(ctx context.Context, prototype *api.MessagePrototype) ([][]api.MessageCheckStatus, error) {
if !prototype.ValidNonce {
nonce, err := s.api.MpoolGetNonce(ctx, prototype.Message.From)
if err != nil {
return nil, xerrors.Errorf("mpool get nonce: %w", err)
}
prototype.Message.Nonce = nonce
prototype.ValidNonce = true
}
var outChecks [][]api.MessageCheckStatus
checks, err := s.api.MpoolCheckMessages(ctx, []*types.Message{&prototype.Message})
checks, err := s.api.MpoolCheckMessages(ctx, []*api.MessagePrototype{prototype})
if err != nil {
return nil, xerrors.Errorf("message check: %w", err)
}