diff --git a/addrmgr/knownaddress.go b/addrmgr/knownaddress.go index 73b6f0f3..4a8da83e 100644 --- a/addrmgr/knownaddress.go +++ b/addrmgr/knownaddress.go @@ -38,12 +38,8 @@ func (ka *KnownAddress) LastAttempt() time.Time { // attempted and how often attempts to connect to it have failed. func (ka *KnownAddress) chance() float64 { now := time.Now() - lastSeen := now.Sub(ka.na.Timestamp) lastAttempt := now.Sub(ka.lastattempt) - if lastSeen < 0 { - lastSeen = 0 - } if lastAttempt < 0 { lastAttempt = 0 } diff --git a/connmgr/tor.go b/connmgr/tor.go index bc73a954..84f5f763 100644 --- a/connmgr/tor.go +++ b/connmgr/tor.go @@ -100,14 +100,11 @@ func TorLookupIP(host, proxy string) ([]net.IP, error) { } if buf[1] != 0 { if int(buf[1]) > len(torStatusErrors) { - err = ErrTorInvalidProxyResponse - } else { - err = torStatusErrors[buf[1]] - if err == nil { - err = ErrTorInvalidProxyResponse - } + return nil, ErrTorInvalidProxyResponse + } else if err := torStatusErrors[buf[1]]; err != nil { + return nil, err } - return nil, err + return nil, ErrTorInvalidProxyResponse } if buf[3] != 1 { err := torStatusErrors[torGeneralError] diff --git a/server.go b/server.go index f7531f68..0f3fad74 100644 --- a/server.go +++ b/server.go @@ -2260,7 +2260,7 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param amgrLog.Warnf("Skipping specified external IP: %v", err) } } - } else if discover && cfg.Upnp { + } else if cfg.Upnp { nat, err = Discover() if err != nil { srvrLog.Warnf("Can't discover upnp: %v", err) diff --git a/txscript/script.go b/txscript/script.go index b7da905f..45ad2372 100644 --- a/txscript/script.go +++ b/txscript/script.go @@ -362,7 +362,6 @@ func calcSignatureHash(script []parsedOpcode, hashType SigHashType, tx *wire.Msg } if hashType&SigHashAnyOneCanPay != 0 { txCopy.TxIn = txCopy.TxIn[idx : idx+1] - idx = 0 } // The final hash is the double sha256 of both the serialized modified diff --git a/txscript/sign.go b/txscript/sign.go index 8960e6b0..03d95c25 100644 --- a/txscript/sign.go +++ b/txscript/sign.go @@ -190,7 +190,7 @@ func mergeScripts(chainParams *chaincfg.Params, tx *wire.MsgTx, idx int, script := sigPops[len(sigPops)-1].data // We already know this information somewhere up the stack. - class, addresses, nrequired, err := + class, addresses, nrequired, _ := ExtractPkScriptAddrs(script, chainParams) // regenerate scripts.