multi: fix linter warnings
This commit is contained in:
parent
2b7326ae52
commit
5596b63846
8 changed files with 19 additions and 45 deletions
|
@ -571,7 +571,7 @@ func (mp *TxPool) checkPoolDoubleSpend(tx *btcutil.Tx) error {
|
||||||
return nil
|
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
|
// transaction in the mempool. If that's the case the spending transaction will
|
||||||
// be returned, if not nil will be returned.
|
// be returned, if not nil will be returned.
|
||||||
func (mp *TxPool) CheckSpend(op wire.OutPoint) *btcutil.Tx {
|
func (mp *TxPool) CheckSpend(op wire.OutPoint) *btcutil.Tx {
|
||||||
|
|
|
@ -1286,6 +1286,10 @@ func (p *Peer) maybeAddDeadline(pendingResponses map[string]time.Time, msgCmd st
|
||||||
// Expects an inv message.
|
// Expects an inv message.
|
||||||
pendingResponses[wire.CmdInv] = deadline
|
pendingResponses[wire.CmdInv] = deadline
|
||||||
|
|
||||||
|
case wire.CmdGetBlocks:
|
||||||
|
// Expects an inv message.
|
||||||
|
pendingResponses[wire.CmdInv] = deadline
|
||||||
|
|
||||||
case wire.CmdGetData:
|
case wire.CmdGetData:
|
||||||
// Expects a block, merkleblock, tx, or notfound message.
|
// Expects a block, merkleblock, tx, or notfound message.
|
||||||
pendingResponses[wire.CmdBlock] = deadline
|
pendingResponses[wire.CmdBlock] = deadline
|
||||||
|
@ -1409,7 +1413,6 @@ out:
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
continue
|
|
||||||
log.Debugf("Peer %s appears to be stalled or "+
|
log.Debugf("Peer %s appears to be stalled or "+
|
||||||
"misbehaving, %s timeout -- "+
|
"misbehaving, %s timeout -- "+
|
||||||
"disconnecting", p, command)
|
"disconnecting", p, command)
|
||||||
|
|
|
@ -333,9 +333,9 @@ var helpDescsEnUS = map[string]string{
|
||||||
"getblocktemplate--result1": "An error string which represents why the proposal was rejected or nothing if accepted",
|
"getblocktemplate--result1": "An error string which represents why the proposal was rejected or nothing if accepted",
|
||||||
|
|
||||||
// GetCFilterCmd help.
|
// GetCFilterCmd help.
|
||||||
"getcfilter--synopsis": "Returns a block's committed filter given its hash.",
|
"getcfilter--synopsis": "Returns a block's committed filter given its hash.",
|
||||||
"getcfilter-hash": "The hash of the block",
|
"getcfilter-hash": "The hash of the block",
|
||||||
"getcfilter--result0": "The block's committed filter",
|
"getcfilter--result0": "The block's committed filter",
|
||||||
|
|
||||||
// GetConnectionCountCmd help.
|
// GetConnectionCountCmd help.
|
||||||
"getconnectioncount--synopsis": "Returns the number of active connections to other peers.",
|
"getconnectioncount--synopsis": "Returns the number of active connections to other peers.",
|
||||||
|
|
|
@ -12,6 +12,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// CFCheckptInterval is the gap (in number of blocks) between each
|
||||||
|
// filter header checkpoint.
|
||||||
CFCheckptInterval = 1000
|
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
|
// Create a contiguous slice of hashes to deserialize into in order to
|
||||||
// reduce the number of allocations.
|
// 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++ {
|
for i := uint64(0); i < count; i++ {
|
||||||
var cfh chainhash.Hash
|
var cfh chainhash.Hash
|
||||||
err := readElement(r, &cfh)
|
err := readElement(r, &cfh)
|
||||||
|
|
|
@ -33,7 +33,7 @@ type MsgCFHeaders struct {
|
||||||
FilterHashes []*chainhash.Hash
|
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 {
|
func (msg *MsgCFHeaders) AddCFHash(hash *chainhash.Hash) error {
|
||||||
if len(msg.FilterHashes)+1 > MaxCFHeadersPerMsg {
|
if len(msg.FilterHashes)+1 > MaxCFHeadersPerMsg {
|
||||||
str := fmt.Sprintf("too many block headers in message [max %v]",
|
str := fmt.Sprintf("too many block headers in message [max %v]",
|
||||||
|
|
|
@ -26,12 +26,7 @@ func (msg *MsgGetCFCheckpt) BtcDecode(r io.Reader, pver uint32, _ MessageEncodin
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = readElement(r, &msg.StopHash)
|
return readElement(r, &msg.StopHash)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
|
// 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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = writeElement(w, &msg.StopHash)
|
return writeElement(w, &msg.StopHash)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command returns the protocol command string for the message. This is part
|
// 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
|
// NewMsgGetCFCheckpt returns a new bitcoin getcfcheckpt message that conforms
|
||||||
// to the Message interface using the passed parameters and defaults for the
|
// to the Message interface using the passed parameters and defaults for the
|
||||||
// remaining fields.
|
// remaining fields.
|
||||||
func NewMsgGetCFCheckpt(filterType FilterType, stopHash *chainhash.Hash,
|
func NewMsgGetCFCheckpt(filterType FilterType, stopHash *chainhash.Hash) *MsgGetCFCheckpt {
|
||||||
) *MsgGetCFCheckpt {
|
|
||||||
return &MsgGetCFCheckpt{
|
return &MsgGetCFCheckpt{
|
||||||
FilterType: filterType,
|
FilterType: filterType,
|
||||||
StopHash: *stopHash,
|
StopHash: *stopHash,
|
||||||
|
|
|
@ -32,12 +32,7 @@ func (msg *MsgGetCFHeaders) BtcDecode(r io.Reader, pver uint32, _ MessageEncodin
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = readElement(r, &msg.StopHash)
|
return readElement(r, &msg.StopHash)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
|
// 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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = writeElement(w, &msg.StopHash)
|
return writeElement(w, &msg.StopHash)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command returns the protocol command string for the message. This is part
|
// Command returns the protocol command string for the message. This is part
|
||||||
|
|
|
@ -36,12 +36,7 @@ func (msg *MsgGetCFilters) BtcDecode(r io.Reader, pver uint32, _ MessageEncoding
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = readElement(r, &msg.StopHash)
|
return readElement(r, &msg.StopHash)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
|
// 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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = writeElement(w, &msg.StopHash)
|
return writeElement(w, &msg.StopHash)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command returns the protocol command string for the message. This is part
|
// Command returns the protocol command string for the message. This is part
|
||||||
|
|
Loading…
Reference in a new issue