Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backports, module updates, and version bump for 2.0.2 #2376

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions chain/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"time"

"decred.org/dcrwallet/v4/errors"
"decred.org/dcrwallet/v4/internal/loggers"
"decred.org/dcrwallet/v4/rpc/client/dcrd"
"decred.org/dcrwallet/v4/validate"
"decred.org/dcrwallet/v4/wallet"
Expand Down Expand Up @@ -926,16 +925,8 @@ func (s *Syncer) mixMessage(ctx context.Context, params json.RawMessage) error {
s.blake256HasherMu.Lock()
msg.WriteHash(s.blake256Hasher)
s.blake256HasherMu.Unlock()
msgHash := msg.Hash()
err = s.wallet.AcceptMixMessage(msg)
if err == nil {
loggers.MixpLog.Debugf("Accepted mix message %T %s by %x",
msg, &msgHash, msg.Pub())
} else {
loggers.MixpLog.Debugf("Rejected mix message %T %s by %x",
msg, &msgHash, msg.Pub())
}

err = s.wallet.AcceptMixMessage(msg)
var e *mixpool.MissingOwnPRError
if errors.As(err, &e) {
ke, ok := msg.(*wire.MsgMixKeyExchange)
Expand All @@ -947,13 +938,8 @@ func (s *Syncer) mixMessage(ctx context.Context, params json.RawMessage) error {
s.blake256HasherMu.Lock()
pr.WriteHash(s.blake256Hasher)
s.blake256HasherMu.Unlock()
prHash := pr.Hash()

err = s.wallet.AcceptMixMessage(pr)
if err == nil {
loggers.MixpLog.Debugf("Accepted missing PR %s for "+
"previous orphan KE %s", &prHash, &msgHash)
}
}
return err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/decred/dcrd/dcrutil/v4 v4.0.2
github.com/decred/dcrd/gcs/v4 v4.1.0
github.com/decred/dcrd/hdkeychain/v3 v3.1.2
github.com/decred/dcrd/mixing v0.2.0
github.com/decred/dcrd/mixing v0.3.0
github.com/decred/dcrd/rpc/jsonrpc/types/v4 v4.3.0
github.com/decred/dcrd/rpcclient/v8 v8.0.1
github.com/decred/dcrd/txscript/v4 v4.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ github.com/decred/dcrd/gcs/v4 v4.1.0 h1:tpW7JW53yJZlgNwl/n2NL1b8NxHaIPRUyNuLMkB/
github.com/decred/dcrd/gcs/v4 v4.1.0/go.mod h1:nPTbGM/I3Ihe5KFvUmxZEqQP/jDZQjQ63+WEi/f4lqU=
github.com/decred/dcrd/hdkeychain/v3 v3.1.2 h1:x25WuuE7zM/20EynuVMyOhL0K8BwGBBsexGq8xTiHFA=
github.com/decred/dcrd/hdkeychain/v3 v3.1.2/go.mod h1:FnNJmZ7jqUDeAo6/c/xkQi5cuxh3EWtJeMmW6/Z8lcc=
github.com/decred/dcrd/mixing v0.2.0 h1:6aQiJuyu3D4OduSRPLta6GX6FZEi4XCxuQVNt26H0rY=
github.com/decred/dcrd/mixing v0.2.0/go.mod h1:W3K7yJKmoI03G2U5Yw+HSRNe6lLBegi63ZR6fFLnM9c=
github.com/decred/dcrd/mixing v0.3.0 h1:eUHpTdwTqXUllnn1ZYLfxucW/2UOkMmx4CyztipTJ9g=
github.com/decred/dcrd/mixing v0.3.0/go.mod h1:W3K7yJKmoI03G2U5Yw+HSRNe6lLBegi63ZR6fFLnM9c=
github.com/decred/dcrd/rpc/jsonrpc/types/v4 v4.3.0 h1:l0DnCcILTNrpy8APF3FLN312ChpkQaAuW30aC/RgBaw=
github.com/decred/dcrd/rpc/jsonrpc/types/v4 v4.3.0/go.mod h1:j+kkRPXPJB5S9VFOsx8SQLcU7PTFkPKRc1aCHN4ENzA=
github.com/decred/dcrd/rpcclient/v8 v8.0.1 h1:hd81e4w1KSqvPcozJlnz6XJfWKDNuahgooH/N5E8vOU=
Expand Down
11 changes: 7 additions & 4 deletions p2p/peering.go
Original file line number Diff line number Diff line change
Expand Up @@ -2141,13 +2141,16 @@ func (rp *RemotePeer) GetInitState(ctx context.Context, msg *wire.MsgGetInitStat
}
}

// invVecContainsTx returns true if at least one inv vector is of type
// transaction.
func invVecContainsTx(inv []*wire.InvVect) bool {
// invVecContainsTxOrMix returns true if at least one inv vector is of type
// transaction or mix message.
func invVecContainsTxOrMix(inv []*wire.InvVect) bool {
for i := range inv {
if inv[i].Type == wire.InvTypeTx {
return true
}
if inv[i].Type == wire.InvTypeMix {
return true
}
}
return false
}
Expand All @@ -2157,7 +2160,7 @@ func (rp *RemotePeer) receivedInv(ctx context.Context, inv *wire.MsgInv) {
const opf = "remotepeer(%v).receivedInv"

// When tx relay is disabled, we don't expect transactions on invs.
if rp.lp.disableRelayTx && invVecContainsTx(inv.InvList) {
if rp.lp.disableRelayTx && invVecContainsTxOrMix(inv.InvList) {
op := errors.Opf(opf, rp.raddr)
err := errors.E(op, errors.Protocol, "received tx in msginv when tx relaying is disabled")
rp.Disconnect(err)
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const semverAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrst
const (
Major = 2
Minor = 0
Patch = 1
Patch = 2
)

// Integer is an integer encoding of the major.minor.patch version.
Expand Down
Loading