neo-go/pkg/core/bench_test.go
AnnaShaleva 2d196b3f35 rpc: refactor calculatenetworkfee handler
Use (Blockchainer).VerifyWitness() to calculate network fee for
contract-based witnesses.
2021-10-25 19:07:25 +03:00

24 lines
602 B
Go

package core
import (
"testing"
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
"github.com/nspcc-dev/neo-go/pkg/wallet"
"github.com/stretchr/testify/require"
)
func BenchmarkVerifyWitness(t *testing.B) {
bc := newTestChain(t)
acc, err := wallet.NewAccount()
require.NoError(t, err)
tx := bc.newTestTx(acc.Contract.ScriptHash(), []byte{byte(opcode.PUSH1)})
require.NoError(t, acc.SignTx(netmode.UnitTestNet, tx))
t.ResetTimer()
for n := 0; n < t.N; n++ {
_, _ = bc.VerifyWitness(tx.Signers[0].Account, tx, &tx.Scripts[0], 100000000)
}
}