lnd: fix issues reported by golint+govet
github.com/lightningnetwork/lnd master ✗
0m ◒
▶ golint
htlcswitch.go:292:4: should replace numUpdates += 1 with numUpdates++
htlcswitch.go:554:6: var onionId should be onionID
htlcswitch.go:629:7: var onionId should be onionID
lnd_test.go:133:1: context.Context should be the first parameter of a
function
lnd_test.go:177:1: context.Context should be the first parameter of a
function
networktest.go:84:2: struct field nodeId should be nodeID
peer.go:1704:16: should omit 2nd value from range; this loop is
equivalent to `for invoice := range ...`
rpcserver.go:57:6: func newRpcServer should be newRPCServer
github.com/lightningnetwork/lnd master ✗
9m ⚑ ◒ ⍉
▶ go vet
features.go:12: github.com/lightningnetwork/lnd/lnwire.Feature
composite literal uses unkeyed fields
fundingmanager.go:380: no formatting directive in Errorf call
exit status 1
This commit is contained in:
8 files changed
+50
-49
No files matched your search
+8
-8
@@ -289,7 +289,7 @@ out:
|
||||
htlcPkt.err <- fmt.Errorf("Insufficient capacity")
|
||||
case pkt := <-h.htlcPlex:
|
||||
// TODO(roasbeef): properly account with cleared vs settled
|
||||
numUpdates += 1
|
||||
numUpdates++
|
||||
|
||||
hswcLog.Tracef("plex packet: %v", newLogClosure(func() string {
|
||||
return spew.Sdump(pkt)
|
||||
@@ -551,15 +551,15 @@ func (h *htlcSwitch) handleRegisterLink(req *registerLinkMsg) {
|
||||
// Next, update the onion index which is used to look up the
|
||||
// settle/clear links during multi-hop payments and to dispatch
|
||||
// outgoing payments initiated by a local subsystem.
|
||||
var onionId [ripemd160.Size]byte
|
||||
copy(onionId[:], btcutil.Hash160(req.peer.addr.IdentityKey.SerializeCompressed()))
|
||||
var onionID [ripemd160.Size]byte
|
||||
copy(onionID[:], btcutil.Hash160(req.peer.addr.IdentityKey.SerializeCompressed()))
|
||||
|
||||
h.onionMtx.Lock()
|
||||
h.onionIndex[onionId] = h.interfaces[interfaceID]
|
||||
h.onionIndex[onionID] = h.interfaces[interfaceID]
|
||||
h.onionMtx.Unlock()
|
||||
|
||||
hswcLog.Infof("registering new link, interface=%x, onion_link=%x, "+
|
||||
"chan_point=%v, capacity=%v", interfaceID[:], onionId,
|
||||
"chan_point=%v, capacity=%v", interfaceID[:], onionID,
|
||||
chanPoint, newLink.capacity)
|
||||
|
||||
if req.done != nil {
|
||||
@@ -626,9 +626,9 @@ func (h *htlcSwitch) handleUnregisterLink(req *unregisterLinkMsg) {
|
||||
// Delete the peer from the onion index so that the
|
||||
// htlcForwarder knows not to attempt to forward any further
|
||||
// HTLCs in this direction.
|
||||
var onionId [ripemd160.Size]byte
|
||||
copy(onionId[:], btcutil.Hash160(req.remoteID))
|
||||
delete(h.onionIndex, onionId)
|
||||
var onionID [ripemd160.Size]byte
|
||||
copy(onionID[:], btcutil.Hash160(req.remoteID))
|
||||
delete(h.onionIndex, onionID)
|
||||
|
||||
// Finally, delete the interface itself so that outgoing
|
||||
// payments don't select this path.
|
||||
|
||||
Reference in new issue
Block a user