From 23622ed283d542a40bfcd8e20a316be5f92b8e49 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 24 Oct 2022 14:24:14 +0300 Subject: [PATCH] [#1959] neofs-adm: Check transaction validity in tests Signed-off-by: Evgenii Stratonikov --- cmd/neofs-adm/internal/modules/morph/local_client.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/neofs-adm/internal/modules/morph/local_client.go b/cmd/neofs-adm/internal/modules/morph/local_client.go index 2778ee0cc..fd75de49e 100644 --- a/cmd/neofs-adm/internal/modules/morph/local_client.go +++ b/cmd/neofs-adm/internal/modules/morph/local_client.go @@ -372,6 +372,13 @@ func (l *localClient) InvokeScript(script []byte, signers []transaction.Signer) } func (l *localClient) SendRawTransaction(tx *transaction.Transaction) (util.Uint256, error) { + // We need to test that transaction was formed correctly to catch as many errors as we can. + bs := tx.Bytes() + _, err := transaction.NewTransactionFromBytes(bs) + if err != nil { + return tx.Hash(), fmt.Errorf("invalid transaction: %w", err) + } + l.transactions = append(l.transactions, tx) return tx.Hash(), nil }