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

Backport and prepare 1.3.2 #456

Merged
merged 3 commits into from
Nov 15, 2023
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
2 changes: 1 addition & 1 deletion cmd/v3tool/dcrwallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"fmt"
"strings"

wallettypes "decred.org/dcrwallet/v4/rpc/jsonrpc/types"
wallettypes "decred.org/dcrwallet/v3/rpc/jsonrpc/types"
"github.com/decred/dcrd/blockchain/stake/v5"
"github.com/decred/dcrd/chaincfg/v3"
"github.com/decred/dcrd/dcrutil/v4"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/decred/vspd
go 1.19

require (
decred.org/dcrwallet/v4 v4.0.0-20230924083701-09bb3c2c5095
decred.org/dcrwallet/v3 v3.1.0
github.com/decred/dcrd/blockchain/stake/v5 v5.0.0
github.com/decred/dcrd/blockchain/standalone/v2 v2.2.0
github.com/decred/dcrd/chaincfg/chainhash v1.0.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
decred.org/dcrwallet/v4 v4.0.0-20230924083701-09bb3c2c5095 h1:Eu9ykx3/PwJGuE1Il7D57Eu1o0DdHk5Fc3WGL7l+9k4=
decred.org/dcrwallet/v4 v4.0.0-20230924083701-09bb3c2c5095/go.mod h1:5mW+Jbpea7fDstBqhWHBs0PCOpDB8yX3VbGNhqLqoRQ=
decred.org/dcrwallet/v3 v3.1.0 h1:JCPnF6ENtkeyWLLhyR6d6hzPAFccbbD0u2Fv2E2mA00=
decred.org/dcrwallet/v3 v3.1.0/go.mod h1:KYWzL2R6ghBLSvB7XXU9S29QwgcqnApCvONMDJ6KCR0=
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI=
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
Expand Down
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const semverAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrst
const (
major = 1
minor = 3
patch = 1
patch = 2
)

// preRelease contains the prerelease name of the application. It is a variable
Expand Down
5 changes: 2 additions & 3 deletions internal/webapi/getfeeaddress.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"sync"
"time"

"decred.org/dcrwallet/v4/wallet/txrules"
"decred.org/dcrwallet/v3/wallet/txrules"
"github.com/decred/dcrd/dcrutil/v4"
"github.com/decred/vspd/database"
"github.com/decred/vspd/rpc"
Expand Down Expand Up @@ -58,10 +58,9 @@ func (w *WebAPI) getCurrentFee(dcrdClient *rpc.DcrdRPC) (dcrutil.Amount, error)

height := int64(bestBlock.Height)
isDCP0010Active := w.cfg.Network.DCP10Active(height)
isDCP0012Active := w.cfg.Network.DCP12Active(height)

fee := txrules.StakePoolTicketFee(sDiff, defaultMinRelayTxFee, int32(bestBlock.Height),
w.cfg.VSPFee, w.cfg.Network.Params, isDCP0010Active, isDCP0012Active)
w.cfg.VSPFee, w.cfg.Network.Params, isDCP0010Active)
if err != nil {
return 0, err
}
Expand Down
35 changes: 31 additions & 4 deletions internal/webapi/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,37 @@ func (w *WebAPI) broadcastTicket(c *gin.Context) {
w.log.Debugf("%s: Broadcasting parent tx %s (ticketHash=%s)", funcName, parentHash, request.TicketHash)
err = dcrdClient.SendRawTransaction(request.ParentHex)
if err != nil {
w.log.Errorf("%s: dcrd.SendRawTransaction for parent tx failed (ticketHash=%s): %v",
funcName, request.TicketHash, err)
w.sendError(types.ErrCannotBroadcastTicket, c)
return
// Unknown output errors have special handling because they
// could be resolved by waiting for network propagation. Any
// other errors are returned to client immediately.
if !strings.Contains(err.Error(), rpc.ErrUnknownOutputs) {
w.log.Errorf("%s: dcrd.SendRawTransaction for parent tx failed (ticketHash=%s): %v",
funcName, request.TicketHash, err)
w.sendError(types.ErrCannotBroadcastTicket, c)
return
}

w.log.Debugf("%s: Parent tx references an unknown output, waiting for it in mempool (ticketHash=%s)",
funcName, request.TicketHash)

txBroadcast := func() bool {
// Wait for 1 second and try again, max 7 attempts.
for i := 0; i < 7; i++ {
time.Sleep(1 * time.Second)
err := dcrdClient.SendRawTransaction(request.ParentHex)
if err == nil {
return true
}
}
return false
}()

if !txBroadcast {
w.log.Errorf("%s: Failed to broadcast parent tx, waiting didn't help (ticketHash=%s)",
funcName, request.TicketHash)
w.sendError(types.ErrCannotBroadcastTicket, c)
return
}
}

} else {
Expand Down
2 changes: 1 addition & 1 deletion rpc/dcrwallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"context"
"fmt"

wallettypes "decred.org/dcrwallet/v4/rpc/jsonrpc/types"
wallettypes "decred.org/dcrwallet/v3/rpc/jsonrpc/types"
"github.com/decred/dcrd/chaincfg/v3"
dcrdtypes "github.com/decred/dcrd/rpc/jsonrpc/types/v4"
"github.com/decred/dcrd/wire"
Expand Down
Loading