Skip to content

Commit 4d93d11

Browse files
multi: fix formatting issues proposed by make fmt
1 parent 5089702 commit 4d93d11

File tree

11 files changed

+94
-101
lines changed

11 files changed

+94
-101
lines changed

internal/legacy/keystore/keystore.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ import (
2121
"sync"
2222
"time"
2323

24-
// consider vendoring this deprecated ripemd160 package
25-
"golang.org/x/crypto/ripemd160" // nolint:staticcheck
26-
2724
"github.com/btcsuite/btcd/btcec/v2"
2825
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
2926
"github.com/btcsuite/btcd/btcutil"
@@ -33,6 +30,7 @@ import (
3330
"github.com/btcsuite/btcd/wire"
3431
"github.com/btcsuite/btcwallet/internal/legacy/rename"
3532
secp "github.com/decred/dcrd/dcrec/secp256k1/v4"
33+
"golang.org/x/crypto/ripemd160" // nolint:staticcheck
3634
)
3735

3836
const (

rpc/legacyrpc/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func NewServer(opts *Options, walletLoader *wallet.Loader, listeners []net.Liste
164164
// httpBasicAuth returns the UTF-8 bytes of the HTTP Basic authentication
165165
// string:
166166
//
167-
// "Basic " + base64(username + ":" + password)
167+
// "Basic " + base64(username + ":" + password)
168168
func httpBasicAuth(username, password string) []byte {
169169
const header = "Basic "
170170
base64 := base64.StdEncoding

rpc/rpcserver/log.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ import (
1818
"os"
1919
"strings"
2020

21-
"google.golang.org/grpc/grpclog"
22-
2321
"github.com/btcsuite/btclog"
22+
"google.golang.org/grpc/grpclog"
2423
)
2524

2625
// UseLogger sets the logger to use for the gRPC server.

rpc/rpcserver/server.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
// Full documentation of the API implemented by this package is maintained in a
99
// language-agnostic document:
1010
//
11-
// https://github.com/btcsuite/btcwallet/blob/master/rpc/documentation/api.md
11+
// https://github.com/btcsuite/btcwallet/blob/master/rpc/documentation/api.md
1212
//
1313
// Any API changes must be performed according to the steps listed here:
1414
//
15-
// https://github.com/btcsuite/btcwallet/blob/master/rpc/documentation/serverchanges.md
15+
// https://github.com/btcsuite/btcwallet/blob/master/rpc/documentation/serverchanges.md
1616
package rpcserver
1717

1818
import (
@@ -21,11 +21,6 @@ import (
2121
"sync"
2222
"time"
2323

24-
"golang.org/x/net/context"
25-
"google.golang.org/grpc"
26-
"google.golang.org/grpc/codes"
27-
"google.golang.org/grpc/status"
28-
2924
"github.com/btcsuite/btcd/btcutil"
3025
"github.com/btcsuite/btcd/btcutil/hdkeychain"
3126
"github.com/btcsuite/btcd/chaincfg/chainhash"
@@ -40,6 +35,10 @@ import (
4035
"github.com/btcsuite/btcwallet/waddrmgr"
4136
"github.com/btcsuite/btcwallet/wallet"
4237
"github.com/btcsuite/btcwallet/walletdb"
38+
"golang.org/x/net/context"
39+
"google.golang.org/grpc"
40+
"google.golang.org/grpc/codes"
41+
"google.golang.org/grpc/status"
4342
)
4443

4544
// Public API version constants
@@ -486,12 +485,12 @@ func (s *walletServer) SignTransaction(ctx context.Context, req *pb.SignTransact
486485
}
487486

488487
// BUGS:
489-
// - The transaction is not inspected to be relevant before publishing using
490-
// sendrawtransaction, so connection errors to btcd could result in the tx
491-
// never being added to the wallet database.
492-
// - Once the above bug is fixed, wallet will require a way to purge invalid
493-
// transactions from the database when they are rejected by the network, other
494-
// than double spending them.
488+
// - The transaction is not inspected to be relevant before publishing using
489+
// sendrawtransaction, so connection errors to btcd could result in the tx
490+
// never being added to the wallet database.
491+
// - Once the above bug is fixed, wallet will require a way to purge invalid
492+
// transactions from the database when they are rejected by the network, other
493+
// than double spending them.
495494
func (s *walletServer) PublishTransaction(ctx context.Context, req *pb.PublishTransactionRequest) (
496495
*pb.PublishTransactionResponse, error) {
497496

rpc/walletrpc/api.pb.go

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

waddrmgr/doc.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Package waddrmgr provides a secure hierarchical deterministic wallet address
77
manager.
88
9-
Overview
9+
# Overview
1010
1111
One of the fundamental jobs of a wallet is to manage addresses, private keys,
1212
and script data associated with them. At a high level, this package provides
@@ -52,14 +52,14 @@ used to decrypt private keys and scripts on demand. Relocking the address
5252
manager actively zeros all private material from memory. In addition, temp
5353
private key material used internally is zeroed as soon as it's used.
5454
55-
Locking and Unlocking
55+
# Locking and Unlocking
5656
5757
As previously mentioned, this package provide facilities for locking and
5858
unlocking the address manager to protect access to private material and remove
5959
it from memory when locked. The Lock, Unlock, and IsLocked functions are used
6060
for this purpose.
6161
62-
Creating a New Address Manager
62+
# Creating a New Address Manager
6363
6464
A new address manager is created via the Create function. This function accepts
6565
a wallet database namespace, passphrases, network, and perhaps most importantly,
@@ -69,28 +69,28 @@ to be recovered with only the seed. The GenerateSeed function in the hdkeychain
6969
package can be used as a convenient way to create a random seed for use with
7070
this function. The address manager is locked immediately upon being created.
7171
72-
Opening an Existing Address Manager
72+
# Opening an Existing Address Manager
7373
7474
An existing address manager is opened via the Open function. This function
7575
accepts an existing wallet database namespace, the public passphrase, and
7676
network. The address manager is opened locked as expected since the open
7777
function does not take the private passphrase to unlock it.
7878
79-
Closing the Address Manager
79+
# Closing the Address Manager
8080
8181
The Close method should be called on the address manager when the caller is done
8282
with it. While it is not required, it is recommended because it sanely shuts
8383
down the database and ensures all private and public key material is purged from
8484
memory.
8585
86-
Managed Addresses
86+
# Managed Addresses
8787
8888
Each address returned by the address manager satisifies the ManagedAddress
8989
interface as well as either the ManagedPubKeyAddress or ManagedScriptAddress
9090
interfaces. These interfaces provide the means to obtain relevant information
9191
about the addresses such as their private keys and scripts.
9292
93-
Chained Addresses
93+
# Chained Addresses
9494
9595
Most callers will make use of the chained addresses for normal operations.
9696
Internal addresses are intended for internal wallet uses such as change outputs,
@@ -101,13 +101,13 @@ been provided. In addition, the LastInternalAddress and LastExternalAddress
101101
functions can be used to get the most recently provided internal and external
102102
address, respectively.
103103
104-
Requesting Existing Addresses
104+
# Requesting Existing Addresses
105105
106106
In addition to generating new addresses, access to old addresses is often
107107
required. Most notably, to sign transactions in order to redeem them. The
108108
Address function provides this capability and returns a ManagedAddress.
109109
110-
Importing Addresses
110+
# Importing Addresses
111111
112112
While the recommended approach is to use the chained addresses discussed above
113113
because they can be deterministically regenerated to avoid losing funds as long
@@ -116,40 +116,40 @@ and as a result, this package provides the ability to import existing private
116116
keys in Wallet Import Format (WIF) and hence the associated public key and
117117
address.
118118
119-
Importing Scripts
119+
# Importing Scripts
120120
121121
In order to support pay-to-script-hash transactions, the script must be securely
122122
stored as it is needed to redeem the transaction. This can be useful for a
123123
variety of scenarios, however the most common use is currently multi-signature
124124
transactions.
125125
126-
Syncing
126+
# Syncing
127127
128128
The address manager also supports storing and retrieving a block hash and height
129129
which the manager is known to have all addresses synced through. The manager
130130
itself does not have any notion of which addresses are synced or not. It only
131131
provides the storage as a convenience for the caller.
132132
133-
Network
133+
# Network
134134
135135
The address manager must be associated with a given network in order to provide
136136
appropriate addresses and reject imported addresses and scripts which don't
137137
apply to the associated network.
138138
139-
Errors
139+
# Errors
140140
141141
All errors returned from this package are of type ManagerError. This allows the
142142
caller to programmatically ascertain the specific reasons for failure by
143143
examining the ErrorCode field of the type asserted ManagerError. For certain
144144
error codes, as documented by the specific error codes, the underlying error
145145
will be contained in the Err field.
146146
147-
Bitcoin Improvement Proposals
147+
# Bitcoin Improvement Proposals
148148
149149
This package includes concepts outlined by the following BIPs:
150150
151-
BIP0032 (https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
152-
BIP0043 (https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki)
153-
BIP0044 (https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)
151+
BIP0032 (https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
152+
BIP0043 (https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki)
153+
BIP0044 (https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)
154154
*/
155155
package waddrmgr

wallet/doc.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ Package wallet provides ...
77
TODO: Flesh out this section
88
99
Overview
10-
1110
*/
1211
package wallet

wallet/psbt_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ import (
99
"encoding/hex"
1010
"testing"
1111

12-
"github.com/btcsuite/btcwallet/wallet/txrules"
13-
"github.com/btcsuite/btcwallet/wallet/txsizes"
14-
"github.com/stretchr/testify/require"
15-
1612
"github.com/btcsuite/btcd/btcutil"
1713
"github.com/btcsuite/btcd/btcutil/psbt"
1814
"github.com/btcsuite/btcd/txscript"
1915
"github.com/btcsuite/btcd/wire"
2016
"github.com/btcsuite/btcwallet/waddrmgr"
17+
"github.com/btcsuite/btcwallet/wallet/txrules"
18+
"github.com/btcsuite/btcwallet/wallet/txsizes"
19+
"github.com/stretchr/testify/require"
2120
)
2221

2322
var (

wallet/recovery.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ func (rm *RecoveryManager) State() *RecoveryState {
189189
//
190190
// These are defined as:
191191
// - Inter-Block Gap: The maximum difference between the derived child indexes
192-
// of the last addresses used in any block and the next address consumed
193-
// by a later block.
192+
// of the last addresses used in any block and the next address consumed
193+
// by a later block.
194194
// - Intra-Block Gap: The maximum difference between the derived child indexes
195-
// of the first address used in any block and the last address used in the
196-
// same block.
195+
// of the first address used in any block and the last address used in the
196+
// same block.
197197
type RecoveryState struct {
198198
// recoveryWindow defines the key-derivation lookahead used when
199199
// attempting to recover the set of used addresses. This value will be
@@ -282,12 +282,12 @@ func NewScopeRecoveryState(recoveryWindow uint32) *ScopeRecoveryState {
282282
// derivation branch.
283283
//
284284
// A branch recovery state supports operations for:
285-
// - Expanding the look-ahead horizon based on which indexes have been found.
286-
// - Registering derived addresses with indexes within the horizon.
287-
// - Reporting an invalid child index that falls into the horizon.
288-
// - Reporting that an address has been found.
289-
// - Retrieving all currently derived addresses for the branch.
290-
// - Looking up a particular address by its child index.
285+
// - Expanding the look-ahead horizon based on which indexes have been found.
286+
// - Registering derived addresses with indexes within the horizon.
287+
// - Reporting an invalid child index that falls into the horizon.
288+
// - Reporting that an address has been found.
289+
// - Retrieving all currently derived addresses for the branch.
290+
// - Looking up a particular address by its child index.
291291
type BranchRecoveryState struct {
292292
// recoveryWindow defines the key-derivation lookahead used when
293293
// attempting to recover the set of addresses on this branch.

walletdb/doc.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/*
66
Package walletdb provides a namespaced database interface for btcwallet.
77
8-
Overview
8+
# Overview
99
1010
A wallet essentially consists of a multitude of stored data such as private
1111
and public keys, key derivation bits, pay-to-script-hash scripts, and various
@@ -26,24 +26,24 @@ the wallet.
2626
2727
A quick overview of the features walletdb provides are as follows:
2828
29-
- Key/value store
30-
- Namespace support
31-
- Allows multiple packages to have their own area in the database without
32-
worrying about conflicts
33-
- Read-only and read-write transactions with both manual and managed modes
34-
- Nested buckets
35-
- Supports registration of backend databases
36-
- Comprehensive test coverage
29+
- Key/value store
30+
- Namespace support
31+
- Allows multiple packages to have their own area in the database without
32+
worrying about conflicts
33+
- Read-only and read-write transactions with both manual and managed modes
34+
- Nested buckets
35+
- Supports registration of backend databases
36+
- Comprehensive test coverage
3737
38-
Database
38+
# Database
3939
4040
The main entry point is the DB interface. It exposes functionality for
4141
creating, retrieving, and removing namespaces. It is obtained via the Create
4242
and Open functions which take a database type string that identifies the
4343
specific database driver (backend) to use as well as arguments specific to the
4444
specified driver.
4545
46-
Namespaces
46+
# Namespaces
4747
4848
The Namespace interface is an abstraction that provides facilities for obtaining
4949
transactions (the Tx interface) that are the basis of all database reads and
@@ -55,14 +55,14 @@ The Begin function provides an unmanaged transaction while the View and Update
5555
functions provide a managed transaction. These are described in more detail
5656
below.
5757
58-
Transactions
58+
# Transactions
5959
6060
The Tx interface provides facilities for rolling back or commiting changes that
6161
took place while the transaction was active. It also provides the root bucket
6262
under which all keys, values, and nested buckets are stored. A transaction
6363
can either be read-only or read-write and managed or unmanaged.
6464
65-
Managed versus Unmanaged Transactions
65+
# Managed versus Unmanaged Transactions
6666
6767
A managed transaction is one where the caller provides a function to execute
6868
within the context of the transaction and the commit or rollback is handled
@@ -75,7 +75,7 @@ call Commit or Rollback when they are finished with it. Leaving transactions
7575
open for long periods of time can have several adverse effects, so it is
7676
recommended that managed transactions are used instead.
7777
78-
Buckets
78+
# Buckets
7979
8080
The Bucket interface provides the ability to manipulate key/value pairs and
8181
nested buckets as well as iterate through them.
@@ -85,15 +85,15 @@ CreateBucket, CreateBucketIfNotExists, and DeleteBucket functions work with
8585
buckets. The ForEach function allows the caller to provide a function to be
8686
called with each key/value pair and nested bucket in the current bucket.
8787
88-
Root Bucket
88+
# Root Bucket
8989
9090
As discussed above, all of the functions which are used to manipulate key/value
9191
pairs and nested buckets exist on the Bucket interface. The root bucket is the
9292
upper-most bucket in a namespace under which data is stored and is created at
9393
the same time as the namespace. Use the RootBucket function on the Tx interface
9494
to retrieve it.
9595
96-
Nested Buckets
96+
# Nested Buckets
9797
9898
The CreateBucket and CreateBucketIfNotExists functions on the Bucket interface
9999
provide the ability to create an arbitrary number of nested buckets. It is

0 commit comments

Comments
 (0)