multi: fix linter warnings

This commit is contained in:
Olaoluwa Osuntokun 2018-05-18 18:55:52 -07:00
parent 2b7326ae52
commit 5596b63846
8 changed files with 19 additions and 45 deletions

View file

@ -571,7 +571,7 @@ func (mp *TxPool) checkPoolDoubleSpend(tx *btcutil.Tx) error {
return nil
}
// CheckSpends checks whether the passed outpoint is already spent by a
// CheckSpend checks whether the passed outpoint is already spent by a
// transaction in the mempool. If that's the case the spending transaction will
// be returned, if not nil will be returned.
func (mp *TxPool) CheckSpend(op wire.OutPoint) *btcutil.Tx {

View file

@ -1286,6 +1286,10 @@ func (p *Peer) maybeAddDeadline(pendingResponses map[string]time.Time, msgCmd st
// Expects an inv message.
pendingResponses[wire.CmdInv] = deadline
case wire.CmdGetBlocks:
// Expects an inv message.
pendingResponses[wire.CmdInv] = deadline
case wire.CmdGetData:
// Expects a block, merkleblock, tx, or notfound message.
pendingResponses[wire.CmdBlock] = deadline
@ -1409,7 +1413,6 @@ out:
continue
}
continue
log.Debugf("Peer %s appears to be stalled or "+
"misbehaving, %s timeout -- "+
"disconnecting", p, command)

View file

@ -12,6 +12,8 @@ import (
)
const (
// CFCheckptInterval is the gap (in number of blocks) between each
// filter header checkpoint.
CFCheckptInterval = 1000
)
@ -60,7 +62,7 @@ func (msg *MsgCFCheckpt) BtcDecode(r io.Reader, pver uint32, _ MessageEncoding)
// Create a contiguous slice of hashes to deserialize into in order to
// reduce the number of allocations.
msg.FilterHeaders = make([]*chainhash.Hash, count, count)
msg.FilterHeaders = make([]*chainhash.Hash, count)
for i := uint64(0); i < count; i++ {
var cfh chainhash.Hash
err := readElement(r, &cfh)

View file

@ -33,7 +33,7 @@ type MsgCFHeaders struct {
FilterHashes []*chainhash.Hash
}
// AddCFHeader adds a new committed filter header to the message.
// AddCFHash adds a new filter hash to the message.
func (msg *MsgCFHeaders) AddCFHash(hash *chainhash.Hash) error {
if len(msg.FilterHashes)+1 > MaxCFHeadersPerMsg {
str := fmt.Sprintf("too many block headers in message [max %v]",

View file

@ -26,12 +26,7 @@ func (msg *MsgGetCFCheckpt) BtcDecode(r io.Reader, pver uint32, _ MessageEncodin
return err
}
err = readElement(r, &msg.StopHash)
if err != nil {
return err
}
return nil
return readElement(r, &msg.StopHash)
}
// BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
@ -42,12 +37,7 @@ func (msg *MsgGetCFCheckpt) BtcEncode(w io.Writer, pver uint32, _ MessageEncodin
return err
}
err = writeElement(w, &msg.StopHash)
if err != nil {
return err
}
return nil
return writeElement(w, &msg.StopHash)
}
// Command returns the protocol command string for the message. This is part
@ -66,8 +56,7 @@ func (msg *MsgGetCFCheckpt) MaxPayloadLength(pver uint32) uint32 {
// NewMsgGetCFCheckpt returns a new bitcoin getcfcheckpt message that conforms
// to the Message interface using the passed parameters and defaults for the
// remaining fields.
func NewMsgGetCFCheckpt(filterType FilterType, stopHash *chainhash.Hash,
) *MsgGetCFCheckpt {
func NewMsgGetCFCheckpt(filterType FilterType, stopHash *chainhash.Hash) *MsgGetCFCheckpt {
return &MsgGetCFCheckpt{
FilterType: filterType,
StopHash: *stopHash,

View file

@ -32,12 +32,7 @@ func (msg *MsgGetCFHeaders) BtcDecode(r io.Reader, pver uint32, _ MessageEncodin
return err
}
err = readElement(r, &msg.StopHash)
if err != nil {
return err
}
return nil
return readElement(r, &msg.StopHash)
}
// BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
@ -53,12 +48,7 @@ func (msg *MsgGetCFHeaders) BtcEncode(w io.Writer, pver uint32, _ MessageEncodin
return err
}
err = writeElement(w, &msg.StopHash)
if err != nil {
return err
}
return nil
return writeElement(w, &msg.StopHash)
}
// Command returns the protocol command string for the message. This is part

View file

@ -36,12 +36,7 @@ func (msg *MsgGetCFilters) BtcDecode(r io.Reader, pver uint32, _ MessageEncoding
return err
}
err = readElement(r, &msg.StopHash)
if err != nil {
return err
}
return nil
return readElement(r, &msg.StopHash)
}
// BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
@ -57,12 +52,7 @@ func (msg *MsgGetCFilters) BtcEncode(w io.Writer, pver uint32, _ MessageEncoding
return err
}
err = writeElement(w, &msg.StopHash)
if err != nil {
return err
}
return nil
return writeElement(w, &msg.StopHash)
}
// Command returns the protocol command string for the message. This is part