Fix warnings from ineffassign
I left one at the end of fullblocktest, since I suspected the unused variable assignments there were set for the possibility of extending the tests.
This commit is contained in:
parent
3d0dfed40b
commit
bf43e56f2f
5 changed files with 6 additions and 14 deletions
|
@ -38,12 +38,8 @@ func (ka *KnownAddress) LastAttempt() time.Time {
|
||||||
// attempted and how often attempts to connect to it have failed.
|
// attempted and how often attempts to connect to it have failed.
|
||||||
func (ka *KnownAddress) chance() float64 {
|
func (ka *KnownAddress) chance() float64 {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
lastSeen := now.Sub(ka.na.Timestamp)
|
|
||||||
lastAttempt := now.Sub(ka.lastattempt)
|
lastAttempt := now.Sub(ka.lastattempt)
|
||||||
|
|
||||||
if lastSeen < 0 {
|
|
||||||
lastSeen = 0
|
|
||||||
}
|
|
||||||
if lastAttempt < 0 {
|
if lastAttempt < 0 {
|
||||||
lastAttempt = 0
|
lastAttempt = 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,15 +100,12 @@ func TorLookupIP(host, proxy string) ([]net.IP, error) {
|
||||||
}
|
}
|
||||||
if buf[1] != 0 {
|
if buf[1] != 0 {
|
||||||
if int(buf[1]) > len(torStatusErrors) {
|
if int(buf[1]) > len(torStatusErrors) {
|
||||||
err = ErrTorInvalidProxyResponse
|
return nil, ErrTorInvalidProxyResponse
|
||||||
} else {
|
} else if err := torStatusErrors[buf[1]]; err != nil {
|
||||||
err = torStatusErrors[buf[1]]
|
|
||||||
if err == nil {
|
|
||||||
err = ErrTorInvalidProxyResponse
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
return nil, ErrTorInvalidProxyResponse
|
||||||
|
}
|
||||||
if buf[3] != 1 {
|
if buf[3] != 1 {
|
||||||
err := torStatusErrors[torGeneralError]
|
err := torStatusErrors[torGeneralError]
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -2260,7 +2260,7 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param
|
||||||
amgrLog.Warnf("Skipping specified external IP: %v", err)
|
amgrLog.Warnf("Skipping specified external IP: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if discover && cfg.Upnp {
|
} else if cfg.Upnp {
|
||||||
nat, err = Discover()
|
nat, err = Discover()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
srvrLog.Warnf("Can't discover upnp: %v", err)
|
srvrLog.Warnf("Can't discover upnp: %v", err)
|
||||||
|
|
|
@ -362,7 +362,6 @@ func calcSignatureHash(script []parsedOpcode, hashType SigHashType, tx *wire.Msg
|
||||||
}
|
}
|
||||||
if hashType&SigHashAnyOneCanPay != 0 {
|
if hashType&SigHashAnyOneCanPay != 0 {
|
||||||
txCopy.TxIn = txCopy.TxIn[idx : idx+1]
|
txCopy.TxIn = txCopy.TxIn[idx : idx+1]
|
||||||
idx = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The final hash is the double sha256 of both the serialized modified
|
// The final hash is the double sha256 of both the serialized modified
|
||||||
|
|
|
@ -190,7 +190,7 @@ func mergeScripts(chainParams *chaincfg.Params, tx *wire.MsgTx, idx int,
|
||||||
script := sigPops[len(sigPops)-1].data
|
script := sigPops[len(sigPops)-1].data
|
||||||
|
|
||||||
// We already know this information somewhere up the stack.
|
// We already know this information somewhere up the stack.
|
||||||
class, addresses, nrequired, err :=
|
class, addresses, nrequired, _ :=
|
||||||
ExtractPkScriptAddrs(script, chainParams)
|
ExtractPkScriptAddrs(script, chainParams)
|
||||||
|
|
||||||
// regenerate scripts.
|
// regenerate scripts.
|
||||||
|
|
Loading…
Reference in a new issue