wallet: implement (*Account).SignTx

It is used in both CLI and RPC.
This commit is contained in:
Evgenii Stratonikov 2020-02-28 19:01:07 +03:00
parent 6541bd4d42
commit 05a3625b7d
6 changed files with 44 additions and 50 deletions

View file

@ -11,7 +11,7 @@ import (
"github.com/CityOfZion/neo-go/pkg/crypto/keys"
"github.com/CityOfZion/neo-go/pkg/encoding/address"
"github.com/CityOfZion/neo-go/pkg/network"
"github.com/CityOfZion/neo-go/pkg/rpc/request"
"github.com/CityOfZion/neo-go/pkg/wallet"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
@ -49,10 +49,12 @@ func prepareData(t *testing.B) []*transaction.Transaction {
var data []*transaction.Transaction
wif := getWif(t)
acc, err := wallet.NewAccountFromWIF(wif.S)
require.NoError(t, err)
for n := 0; n < t.N; n++ {
tx := getTX(t, wif)
require.NoError(t, request.SignTx(tx, wif))
require.NoError(t, acc.SignTx(tx))
data = append(data, tx)
}
return data