From 9da8333a6e655cac645cd40f0f5f89fca196ace4 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 5 Jan 2022 11:04:14 +0100 Subject: [PATCH] multi: fix formatting --- input/signer.go | 7 ++--- lnrpc/signrpc/signer_server.go | 3 ++- lntest/mock/walletcontroller.go | 47 ++++++++++++++++++--------------- lnwallet/btcwallet/signer.go | 4 ++- lnwallet/interface.go | 13 +++++---- 5 files changed, 43 insertions(+), 31 deletions(-) diff --git a/input/signer.go b/input/signer.go index 86622638e..5d6f4257b 100644 --- a/input/signer.go +++ b/input/signer.go @@ -14,8 +14,8 @@ type Signer interface { // according to the data within the passed SignDescriptor. // // NOTE: The resulting signature should be void of a sighash byte. - SignOutputRaw(tx *wire.MsgTx, - signDesc *SignDescriptor) (Signature, error) + SignOutputRaw(tx *wire.MsgTx, signDesc *SignDescriptor) (Signature, + error) // ComputeInputScript generates a complete InputIndex for the passed // transaction with the signature as defined within the passed @@ -26,7 +26,8 @@ type Signer interface { // NOTE: This method will ignore any tweak parameters set within the // passed SignDescriptor as it assumes a set of typical script // templates (p2wkh, np2wkh, etc). - ComputeInputScript(tx *wire.MsgTx, signDesc *SignDescriptor) (*Script, error) + ComputeInputScript(tx *wire.MsgTx, signDesc *SignDescriptor) (*Script, + error) } // Script represents any script inputs required to redeem a previous diff --git a/lnrpc/signrpc/signer_server.go b/lnrpc/signrpc/signer_server.go index 51c2e55ed..147e146f2 100644 --- a/lnrpc/signrpc/signer_server.go +++ b/lnrpc/signrpc/signer_server.go @@ -238,7 +238,8 @@ func (r *ServerShell) CreateSubServer(configRegistry lnrpc.SubServerConfigDispat // provides an invalid transaction, then we'll return with an error. // // NOTE: The resulting signature should be void of a sighash byte. -func (s *Server) SignOutputRaw(ctx context.Context, in *SignReq) (*SignResp, error) { +func (s *Server) SignOutputRaw(ctx context.Context, in *SignReq) (*SignResp, + error) { switch { // If the client doesn't specify a transaction, then there's nothing to diff --git a/lntest/mock/walletcontroller.go b/lntest/mock/walletcontroller.go index 959fb5382..7df080257 100644 --- a/lntest/mock/walletcontroller.go +++ b/lntest/mock/walletcontroller.go @@ -54,14 +54,15 @@ func (w *WalletController) FetchInputInfo( } // ConfirmedBalance currently returns dummy values. -func (w *WalletController) ConfirmedBalance(confs int32, - _ string) (btcutil.Amount, error) { +func (w *WalletController) ConfirmedBalance(int32, string) (btcutil.Amount, + error) { + return 0, nil } // NewAddress is called to get new addresses for delivery, change etc. -func (w *WalletController) NewAddress(addrType lnwallet.AddressType, - change bool, _ string) (btcutil.Address, error) { +func (w *WalletController) NewAddress(lnwallet.AddressType, bool, + string) (btcutil.Address, error) { addr, _ := btcutil.NewAddressPubKey( w.RootKey.PubKey().SerializeCompressed(), &chaincfg.MainNetParams, @@ -70,19 +71,21 @@ func (w *WalletController) NewAddress(addrType lnwallet.AddressType, } // LastUnusedAddress currently returns dummy values. -func (w *WalletController) LastUnusedAddress(addrType lnwallet.AddressType, - _ string) (btcutil.Address, error) { +func (w *WalletController) LastUnusedAddress(lnwallet.AddressType, + string) (btcutil.Address, error) { + return nil, nil } // IsOurAddress currently returns a dummy value. -func (w *WalletController) IsOurAddress(a btcutil.Address) bool { +func (w *WalletController) IsOurAddress(btcutil.Address) bool { return false } // ListAccounts currently returns a dummy value. -func (w *WalletController) ListAccounts(_ string, - _ *waddrmgr.KeyScope) ([]*waddrmgr.AccountProperties, error) { +func (w *WalletController) ListAccounts(string, + *waddrmgr.KeyScope) ([]*waddrmgr.AccountProperties, error) { + return nil, nil } @@ -90,33 +93,35 @@ func (w *WalletController) ListAccounts(_ string, func (w *WalletController) ImportAccount(string, *hdkeychain.ExtendedKey, uint32, *waddrmgr.AddressType, bool) (*waddrmgr.AccountProperties, []btcutil.Address, []btcutil.Address, error) { + return nil, nil, nil, nil } // ImportPublicKey currently returns a dummy value. func (w *WalletController) ImportPublicKey(*btcec.PublicKey, waddrmgr.AddressType) error { + return nil } // SendOutputs currently returns dummy values. -func (w *WalletController) SendOutputs(outputs []*wire.TxOut, - _ chainfee.SatPerKWeight, _ int32, _ string) (*wire.MsgTx, error) { +func (w *WalletController) SendOutputs([]*wire.TxOut, + chainfee.SatPerKWeight, int32, string) (*wire.MsgTx, error) { return nil, nil } // CreateSimpleTx currently returns dummy values. -func (w *WalletController) CreateSimpleTx(outputs []*wire.TxOut, - _ chainfee.SatPerKWeight, _ int32, _ bool) (*txauthor.AuthoredTx, error) { +func (w *WalletController) CreateSimpleTx([]*wire.TxOut, + chainfee.SatPerKWeight, int32, bool) (*txauthor.AuthoredTx, error) { return nil, nil } // ListUnspentWitness is called by the wallet when doing coin selection. We just // need one unspent for the funding transaction. -func (w *WalletController) ListUnspentWitness(minConfs, - maxConfs int32, _ string) ([]*lnwallet.Utxo, error) { +func (w *WalletController) ListUnspentWitness(int32, int32, + string) ([]*lnwallet.Utxo, error) { // If the mock already has a list of utxos, return it. if w.Utxos != nil { @@ -140,8 +145,8 @@ func (w *WalletController) ListUnspentWitness(minConfs, } // ListTransactionDetails currently returns dummy values. -func (w *WalletController) ListTransactionDetails(_, - _ int32, _ string) ([]*lnwallet.TransactionDetail, error) { +func (w *WalletController) ListTransactionDetails(int32, int32, + string) ([]*lnwallet.TransactionDetail, error) { return nil, nil } @@ -169,8 +174,8 @@ func (w *WalletController) ListLeasedOutputs() ([]*wtxmgr.LockedOutput, error) { } // FundPsbt currently does nothing. -func (w *WalletController) FundPsbt(_ *psbt.Packet, _ int32, - _ chainfee.SatPerKWeight, _ string) (int32, error) { +func (w *WalletController) FundPsbt(*psbt.Packet, int32, chainfee.SatPerKWeight, + string) (int32, error) { return 0, nil } @@ -187,8 +192,8 @@ func (w *WalletController) PublishTransaction(tx *wire.MsgTx, _ string) error { } // LabelTransaction currently does nothing. -func (w *WalletController) LabelTransaction(_ chainhash.Hash, _ string, - _ bool) error { +func (w *WalletController) LabelTransaction(chainhash.Hash, string, + bool) error { return nil } diff --git a/lnwallet/btcwallet/signer.go b/lnwallet/btcwallet/signer.go index 277f39132..a6a525e7d 100644 --- a/lnwallet/btcwallet/signer.go +++ b/lnwallet/btcwallet/signer.go @@ -66,7 +66,9 @@ func deriveFromKeyLoc(scopedMgr *waddrmgr.ScopedKeyManager, // deriveKeyByLocator attempts to derive a key stored in the wallet given a // valid key locator. -func (b *BtcWallet) deriveKeyByLocator(keyLoc keychain.KeyLocator) (*btcec.PrivateKey, error) { +func (b *BtcWallet) deriveKeyByLocator( + keyLoc keychain.KeyLocator) (*btcec.PrivateKey, error) { + // We'll assume the special lightning key scope in this case. scopedMgr, err := b.wallet.Manager.FetchScopedKeyManager( b.chainKeyScope, diff --git a/lnwallet/interface.go b/lnwallet/interface.go index 42c2f633a..c6531ebd9 100644 --- a/lnwallet/interface.go +++ b/lnwallet/interface.go @@ -168,7 +168,8 @@ type WalletController interface { // NOTE: Only witness outputs should be included in the computation of // the total spendable balance of the wallet. We require this as only // witness inputs can be used for funding channels. - ConfirmedBalance(confs int32, accountFilter string) (btcutil.Amount, error) + ConfirmedBalance(confs int32, accountFilter string) (btcutil.Amount, + error) // NewAddress returns the next external or internal address for the // wallet dictated by the value of the `change` parameter. If change is @@ -197,7 +198,8 @@ type WalletController interface { // ListAccounts retrieves all accounts belonging to the wallet by // default. A name and key scope filter can be provided to filter // through all of the wallet accounts and return only those matching. - ListAccounts(string, *waddrmgr.KeyScope) ([]*waddrmgr.AccountProperties, error) + ListAccounts(string, *waddrmgr.KeyScope) ([]*waddrmgr.AccountProperties, + error) // ImportAccount imports an account backed by an account extended public // key. The master key fingerprint denotes the fingerprint of the root @@ -228,7 +230,8 @@ type WalletController interface { // in the case of legacy versions (xpub, tpub), an address type must be // specified as we intend to not support importing BIP-44 keys into the // wallet using the legacy pay-to-pubkey-hash (P2PKH) scheme. - ImportPublicKey(pubKey *btcec.PublicKey, addrType waddrmgr.AddressType) error + ImportPublicKey(pubKey *btcec.PublicKey, + addrType waddrmgr.AddressType) error // SendOutputs funds, signs, and broadcasts a Bitcoin transaction paying // out to the specified outputs. In the case the wallet has insufficient @@ -237,8 +240,8 @@ type WalletController interface { // be used when crafting the transaction. // // NOTE: This method requires the global coin selection lock to be held. - SendOutputs(outputs []*wire.TxOut, - feeRate chainfee.SatPerKWeight, minConfs int32, label string) (*wire.MsgTx, error) + SendOutputs(outputs []*wire.TxOut, feeRate chainfee.SatPerKWeight, + minConfs int32, label string) (*wire.MsgTx, error) // CreateSimpleTx creates a Bitcoin transaction paying to the specified // outputs. The transaction is not broadcasted to the network. In the