diff --git a/addrmgr/addrmanager.go b/addrmgr/addrmanager.go index b30c7279a9..33c6ab135d 100644 --- a/addrmgr/addrmanager.go +++ b/addrmgr/addrmanager.go @@ -70,7 +70,7 @@ type localAddress struct { score AddressPriority } -// AddressPriority type is used to describe the heirarchy of local address +// AddressPriority type is used to describe the hierarchy of local address // discovery methods. type AddressPriority int @@ -78,7 +78,7 @@ const ( // InterfacePrio signifies the address is on a local interface InterfacePrio AddressPriority = iota - // BoundPrio signifies the address has been explicity bounded to. + // BoundPrio signifies the address has been explicitly bounded to. BoundPrio // UpnpPrio signifies the address was obtained from UPnP. @@ -114,11 +114,11 @@ const ( // bucket. newBucketSize = 64 - // newBucketCount is the number of buckets taht we spread new addresses + // newBucketCount is the number of buckets that we spread new addresses // over. newBucketCount = 256 - // triedBucketsPerGroup is the number of trieed buckets over which an + // triedBucketsPerGroup is the number of tried buckets over which an // address group will be spread. triedBucketsPerGroup = 4 @@ -171,7 +171,7 @@ func (a *AddrManager) updateAddress(netAddr, srcAddr *btcwire.NetAddress) { addr := NetAddressKey(netAddr) ka := a.find(netAddr) if ka != nil { - // TODO(oga) only update adresses periodically. + // TODO(oga) only update addresses periodically. // Update the last seen time and services. // note that to prevent causing excess garbage on getaddr // messages the netaddresses in addrmaanger are *immutable*, @@ -198,7 +198,7 @@ func (a *AddrManager) updateAddress(netAddr, srcAddr *btcwire.NetAddress) { } // The more entries we have, the less likely we are to add more. - // likelyhood is 2N. + // likelihood is 2N. factor := int32(2 * ka.refs) if a.rand.Int31n(factor) != 0 { return @@ -294,7 +294,7 @@ func (a *AddrManager) pickTried(bucket int) *list.Element { func (a *AddrManager) getNewBucket(netAddr, srcAddr *btcwire.NetAddress) int { // bitcoind: - // doublesha256(key + sourcegroup + int64(doublesha256(key + group + sourcegroup))%bucket_per_source_group) % num_new_buckes + // doublesha256(key + sourcegroup + int64(doublesha256(key + group + sourcegroup))%bucket_per_source_group) % num_new_buckets data1 := []byte{} data1 = append(data1, a.key[:]...) @@ -718,7 +718,7 @@ func (a *AddrManager) HostToNetAddress(host string, port uint16, services btcwir // ipString returns a string for the ip from the provided NetAddress. If the // ip is in the range used for tor addresses then it will be transformed into -// the relavent .onion address. +// the relevant .onion address. func ipString(na *btcwire.NetAddress) string { if IsOnionCatTor(na) { // We know now that na.IP is long enogh. @@ -865,7 +865,7 @@ func (a *AddrManager) Connected(addr *btcwire.NetAddress) { } // Good marks the given address as good. To be called after a successful -// connection and version exchange. If the address is unknown to the addresss +// connection and version exchange. If the address is unknown to the address // manager it will be ignored. func (a *AddrManager) Good(addr *btcwire.NetAddress) { a.mtx.Lock() diff --git a/addrmgr/network.go b/addrmgr/network.go index ec281d130a..afcc253134 100644 --- a/addrmgr/network.go +++ b/addrmgr/network.go @@ -12,7 +12,7 @@ import ( ) var ( - // rfc1918Nets specifies the IPv4 private adddress blocks as defined by + // rfc1918Nets specifies the IPv4 private address blocks as defined by // by RFC1918 (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16). rfc1918Nets = []net.IPNet{ ipNet("10.0.0.0", 8, 32), diff --git a/blockmanager.go b/blockmanager.go index 4d65899e1a..812b66f5c6 100644 --- a/blockmanager.go +++ b/blockmanager.go @@ -109,7 +109,7 @@ type processBlockResponse struct { // processBlockMsg is a message type to be sent across the message channel // for requested a block is processed. Note this call differs from blockMsg -// above in that blockMsg is intended for blocks that can from peers and have +// above in that blockMsg is intended for blocks that came from peers and have // extra handling whereas this message essentially is just a concurrent safe // way to call ProcessBlock on the internal block chain instance. type processBlockMsg struct { diff --git a/config.go b/config.go index f72d750709..acde6f6803 100644 --- a/config.go +++ b/config.go @@ -120,7 +120,7 @@ type serviceOptions struct { ServiceCommand string `short:"s" long:"service" description:"Service command {install, remove, start, stop}"` } -// cleanAndExpandPath expands environement variables and leading ~ in the +// cleanAndExpandPath expands environment variables and leading ~ in the // passed path, cleans the result, and returns it. func cleanAndExpandPath(path string) string { // Expand initial ~ to OS specific home directory. diff --git a/log.go b/log.go index 6825e8b31a..861072daa0 100644 --- a/log.go +++ b/log.go @@ -218,7 +218,7 @@ func formatLockTime(lockTime uint32) string { return time.Unix(int64(lockTime), 0).String() } -// invSummary returns an inventory messege as a human-readable string. +// invSummary returns an inventory message as a human-readable string. func invSummary(invList []*btcwire.InvVect) string { // No inventory. invLen := len(invList) diff --git a/mining.go b/mining.go index ba580e9499..87b82f270f 100644 --- a/mining.go +++ b/mining.go @@ -68,7 +68,7 @@ type txPrioItem struct { } // txPriorityQueueLessFunc describes a function that can be used as a compare -// function for a transation priority queue (txPriorityQueue). +// function for a transaction priority queue (txPriorityQueue). type txPriorityQueueLessFunc func(*txPriorityQueue, int, int) bool // txPriorityQueue implements a priority queue of txPrioItem elements that diff --git a/peer.go b/peer.go index 25b0cd1bd2..5e32bb13c8 100644 --- a/peer.go +++ b/peer.go @@ -116,7 +116,7 @@ func newNetAddress(addr net.Addr, services btcwire.ServiceFlag) (*btcwire.NetAdd } // outMsg is used to house a message to be sent along with a channel to signal -// when the message has been sent (or won't be sent due to tings such as +// when the message has been sent (or won't be sent due to things such as // shutdown) type outMsg struct { msg btcwire.Message @@ -127,7 +127,7 @@ type outMsg struct { // overall data flow is split into 3 goroutines and a separate block manager. // Inbound messages are read via the inHandler goroutine and generally // dispatched to their own handler. For inbound data-related messages such as -// blocks, transactions, and inventory, the data is pased on to the block +// blocks, transactions, and inventory, the data is passed on to the block // manager to handle it. Outbound messages are queued via QueueMessage or // QueueInventory. QueueMessage is intended for all messages, including // responses to data such as blocks and transactions. QueueInventory, on the @@ -527,7 +527,7 @@ func (p *peer) pushBlockMsg(sha *btcwire.ShaHash, doneChan, waitChan chan struct // pushMerkleBlockMsg sends a merkleblock message for the provided block hash to // the connected peer. Since a merkle block requires the peer to have a filter -// loaded, this call will simply be ignored if there is no filter laoded. An +// loaded, this call will simply be ignored if there is no filter loaded. An // error is returned if the block hash is not known. func (p *peer) pushMerkleBlockMsg(sha *btcwire.ShaHash, doneChan, waitChan chan struct{}) error { // Do not send a response if the peer doesn't have a filter loaded. @@ -1055,7 +1055,7 @@ func (p *peer) handleGetHeadersMsg(msg *btcwire.MsgGetHeaders) { // handleFilterAddMsg is invoked when a peer receives a filteradd bitcoin // message and is used by remote peers to add data to an already loaded bloom -// filter. The peer will be disonnected if a filter is not loaded when this +// filter. The peer will be disconnected if a filter is not loaded when this // message is received. func (p *peer) handleFilterAddMsg(msg *btcwire.MsgFilterAdd) { if !p.filter.IsLoaded() { @@ -1070,7 +1070,7 @@ func (p *peer) handleFilterAddMsg(msg *btcwire.MsgFilterAdd) { // handleFilterClearMsg is invoked when a peer receives a filterclear bitcoin // message and is used by remote peers to clear an already loaded bloom filter. -// The peer will be disonnected if a filter is not loaded when this message is +// The peer will be disconnected if a filter is not loaded when this message is // received. func (p *peer) handleFilterClearMsg(msg *btcwire.MsgFilterClear) { if !p.filter.IsLoaded() { diff --git a/rpcwebsocket.go b/rpcwebsocket.go index 0d59eb1d1f..d47ea60346 100644 --- a/rpcwebsocket.go +++ b/rpcwebsocket.go @@ -466,7 +466,7 @@ func (m *wsNotificationManager) UnregisterNewMempoolTxsUpdates(wsc *wsClient) { m.queueNotification <- (*notificationUnregisterNewMempoolTxs)(wsc) } -// notifyForNewTx notifies websocket clients that have registerd for updates +// notifyForNewTx notifies websocket clients that have registered for updates // when a new transaction is added to the memory pool. func (m *wsNotificationManager) notifyForNewTx(clients map[chan struct{}]*wsClient, tx *btcutil.Tx) { txShaStr := tx.Sha().String() @@ -821,7 +821,7 @@ func newWsNotificationManager(server *rpcServer) *wsNotificationManager { } } -// wsResponse houses a message to send to the a connected websocket client as +// wsResponse houses a message to send to a connected websocket client as // well as a channel to reply on when the message is sent. type wsResponse struct { msg []byte diff --git a/server.go b/server.go index 3e6640cc04..40118a0bb2 100644 --- a/server.go +++ b/server.go @@ -540,7 +540,7 @@ func (s *server) seedFromDNS() { // peerHandler is used to handle peer operations such as adding and removing // peers to and from the server, banning peers, and broadcasting messages to -// peers. It must be run a a goroutine. +// peers. It must be run in a goroutine. func (s *server) peerHandler() { // Start the address manager and block manager, both of which are needed // by peers. This is done here since their lifecycle is closely tied diff --git a/upgrade.go b/upgrade.go index 5fb6cad6fc..f6f83ca6e6 100644 --- a/upgrade.go +++ b/upgrade.go @@ -61,7 +61,7 @@ func upgradeDBPathNet(oldDbPath, netName string) error { } // The new database name is based on the database type and - // resides in the a directory named after the network type. + // resides in a directory named after the network type. newDbRoot := filepath.Join(filepath.Dir(cfg.DataDir), netName) newDbName := blockDbNamePrefix + "_" + oldDbType if oldDbType == "sqlite" { @@ -91,7 +91,7 @@ func upgradeDBPaths() error { // Prior to version 0.2.0, the databases were in the "db" directory and // their names were suffixed by "testnet" and "regtest" for their // respective networks. Check for the old database and update it to the - // new path introduced with version 0.2.0 accodingly. + // new path introduced with version 0.2.0 accordingly. oldDbRoot := filepath.Join(oldBtcdHomeDir(), "db") upgradeDBPathNet(filepath.Join(oldDbRoot, "btcd.db"), "mainnet") upgradeDBPathNet(filepath.Join(oldDbRoot, "btcd_testnet.db"), "testnet")