From 483510947096928612cadf6e3a91c1d6d466b13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 9 Oct 2020 00:51:04 +0200 Subject: [PATCH] wallet: Post-merge fixes --- api/api_wallet.go | 3 ++- chain/messagesigner/messagesigner.go | 10 +++++----- chain/wallet/key.go | 2 +- chain/wallet/wallet.go | 2 +- cmd/lotus-wallet/logged.go | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/api/api_wallet.go b/api/api_wallet.go index 06b00a75b..9c289ca95 100644 --- a/api/api_wallet.go +++ b/api/api_wallet.go @@ -4,8 +4,9 @@ import ( "context" "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/crypto" + "github.com/filecoin-project/lotus/chain/types" - "github.com/filecoin-project/specs-actors/actors/crypto" ) type WalletAPI interface { diff --git a/chain/messagesigner/messagesigner.go b/chain/messagesigner/messagesigner.go index ac94d6a3e..1240485b8 100644 --- a/chain/messagesigner/messagesigner.go +++ b/chain/messagesigner/messagesigner.go @@ -3,12 +3,12 @@ package messagesigner import ( "bytes" "context" + "github.com/filecoin-project/lotus/api" "sync" "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/chain/messagepool" "github.com/filecoin-project/lotus/chain/types" - "github.com/filecoin-project/lotus/chain/wallet" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/namespace" @@ -28,17 +28,17 @@ type mpoolAPI interface { // MessageSigner keeps track of nonces per address, and increments the nonce // when signing a message type MessageSigner struct { - wallet *wallet.Wallet + wallet api.WalletAPI lk sync.Mutex mpool mpoolAPI ds datastore.Batching } -func NewMessageSigner(wallet *wallet.Wallet, mpool *messagepool.MessagePool, ds dtypes.MetadataDS) *MessageSigner { +func NewMessageSigner(wallet api.WalletAPI, mpool *messagepool.MessagePool, ds dtypes.MetadataDS) *MessageSigner { return newMessageSigner(wallet, mpool, ds) } -func newMessageSigner(wallet *wallet.Wallet, mpool mpoolAPI, ds dtypes.MetadataDS) *MessageSigner { +func newMessageSigner(wallet api.WalletAPI, mpool mpoolAPI, ds dtypes.MetadataDS) *MessageSigner { ds = namespace.Wrap(ds, datastore.NewKey("/message-signer/")) return &MessageSigner{ wallet: wallet, @@ -61,7 +61,7 @@ func (ms *MessageSigner) SignMessage(ctx context.Context, msg *types.Message, cb // Sign the message with the nonce msg.Nonce = nonce - sig, err := ms.wallet.Sign(ctx, msg.From, msg.Cid().Bytes()) + sig, err := ms.wallet.WalletSign(ctx, msg.From, msg.Cid().Bytes()) if err != nil { return nil, xerrors.Errorf("failed to sign message: %w", err) } diff --git a/chain/wallet/key.go b/chain/wallet/key.go index 2d4ecafd7..4b746a17a 100644 --- a/chain/wallet/key.go +++ b/chain/wallet/key.go @@ -4,7 +4,7 @@ import ( "golang.org/x/xerrors" "github.com/filecoin-project/go-address" - "github.com/filecoin-project/specs-actors/actors/crypto" + "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/lib/sigs" diff --git a/chain/wallet/wallet.go b/chain/wallet/wallet.go index b4c846d37..5f501307f 100644 --- a/chain/wallet/wallet.go +++ b/chain/wallet/wallet.go @@ -152,7 +152,7 @@ func (w *LocalWallet) tryFind(addr address.Address) (types.KeyInfo, error) { return ki, nil } -func (w *LocalWallet) Export(ctx context.Context, addr address.Address) (*types.KeyInfo, error) { +func (w *LocalWallet) WalletExport(ctx context.Context, addr address.Address) (*types.KeyInfo, error) { k, err := w.findKey(addr) if err != nil { return nil, xerrors.Errorf("failed to find key to export: %w", err) diff --git a/cmd/lotus-wallet/logged.go b/cmd/lotus-wallet/logged.go index e73daae90..4cdd62825 100644 --- a/cmd/lotus-wallet/logged.go +++ b/cmd/lotus-wallet/logged.go @@ -4,7 +4,7 @@ import ( "context" "github.com/filecoin-project/go-address" - "github.com/filecoin-project/specs-actors/actors/crypto" + "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/types"