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:
Steven Roose 2017-05-30 16:46:31 +02:00 committed by Dave Collins
parent 3d0dfed40b
commit bf43e56f2f
5 changed files with 6 additions and 14 deletions

View file

@ -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
} }

View file

@ -100,14 +100,11 @@ 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]] return nil, err
if err == nil {
err = ErrTorInvalidProxyResponse
}
} }
return nil, err return nil, ErrTorInvalidProxyResponse
} }
if buf[3] != 1 { if buf[3] != 1 {
err := torStatusErrors[torGeneralError] err := torStatusErrors[torGeneralError]

View file

@ -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)

View file

@ -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

View file

@ -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.