From 4c5cef61b20735bd66746a7b7da77a182a6c38cd Mon Sep 17 00:00:00 2001 From: jholdstock Date: Mon, 9 Sep 2024 09:42:04 +0100 Subject: [PATCH 1/2] rpcserver: Bump gRPC major version to 8. Preparing for some up-coming breaking changes. --- internal/rpc/rpcserver/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/rpc/rpcserver/server.go b/internal/rpc/rpcserver/server.go index a4712ae19..076f4b7a2 100644 --- a/internal/rpc/rpcserver/server.go +++ b/internal/rpc/rpcserver/server.go @@ -62,9 +62,9 @@ import ( // Public API version constants const ( - semverString = "7.17.0" - semverMajor = 7 - semverMinor = 17 + semverString = "8.0.0" + semverMajor = 8 + semverMinor = 0 semverPatch = 0 ) From ce78dfc810cd0e11e85933ea8eac302906d16465 Mon Sep 17 00:00:00 2001 From: jholdstock Date: Mon, 9 Sep 2024 08:56:24 +0100 Subject: [PATCH 2/2] multi: Remove stakepool ticket purchasing. It was possible to set legacy stakepool options either through config or through various RPC parameters, however the options either did nothing or enabled behaviour which is no longer valid. Breaking changes: 1. Removed PoolAddress and PoolFee parameters from gRPCs `purchasetickets` and `runticketbuyer` 1. Removed PoolAddress and PoolFee parameters from json-RPC `purchaseticket` 1. Removed config flags `--pooladdress` and `--poolfees` --- config.go | 28 +-- dcrwallet.go | 10 +- internal/loader/loader.go | 8 - internal/rpc/jsonrpc/methods.go | 25 --- internal/rpc/jsonrpc/rpcserverhelp.go | 4 +- internal/rpc/rpcserver/server.go | 46 ----- internal/rpchelp/helpdescs_en_US.go | 2 - rpc/api.proto | 46 +++-- rpc/client/dcrwallet/methods.go | 6 +- rpc/documentation/api.md | 17 +- rpc/jsonrpc/types/methods.go | 6 +- rpc/walletrpc/api.pb.go | 154 ++++++----------- ticketbuyer/tb.go | 14 +- wallet/createtx.go | 240 ++++---------------------- wallet/wallet.go | 10 -- 15 files changed, 129 insertions(+), 487 deletions(-) diff --git a/config.go b/config.go index cf75a1344..fe6663794 100644 --- a/config.go +++ b/config.go @@ -102,16 +102,13 @@ type config struct { CPUProfile string `long:"cpuprofile" description:"Write cpu profile to the specified file"` // Wallet options - WalletPass string `long:"walletpass" default-mask:"-" description:"Public wallet password; required when created with one"` - PromptPass bool `long:"promptpass" description:"Prompt for private passphase from terminal and unlock without timeout"` - Pass string `long:"pass" description:"Unlock with private passphrase"` - PromptPublicPass bool `long:"promptpublicpass" description:"Prompt for public passphrase from terminal"` - EnableTicketBuyer bool `long:"enableticketbuyer" description:"Enable the automatic ticket buyer"` - EnableVoting bool `long:"enablevoting" description:"Automatically vote on winning tickets"` - PurchaseAccount string `long:"purchaseaccount" description:"Account to autobuy tickets from"` - PoolAddress *cfgutil.AddressFlag `long:"pooladdress" description:"VSP fee address"` - poolAddress stdaddr.StakeAddress - PoolFees float64 `long:"poolfees" description:"VSP fee percentage (1.00 equals 1.00% fee)"` + WalletPass string `long:"walletpass" default-mask:"-" description:"Public wallet password; required when created with one"` + PromptPass bool `long:"promptpass" description:"Prompt for private passphase from terminal and unlock without timeout"` + Pass string `long:"pass" description:"Unlock with private passphrase"` + PromptPublicPass bool `long:"promptpublicpass" description:"Prompt for public passphrase from terminal"` + EnableTicketBuyer bool `long:"enableticketbuyer" description:"Enable the automatic ticket buyer"` + EnableVoting bool `long:"enablevoting" description:"Automatically vote on winning tickets"` + PurchaseAccount string `long:"purchaseaccount" description:"Account to autobuy tickets from"` GapLimit uint32 `long:"gaplimit" description:"Allowed unused address gap between used addresses of accounts"` WatchLast uint32 `long:"watchlast" description:"Limit watched previous addresses of each HD account branch"` ManualTickets bool `long:"manualtickets" description:"Do not discover new tickets through network synchronization"` @@ -380,7 +377,6 @@ func loadConfig(ctx context.Context) (*config, []string, error) { GapLimit: defaultGapLimit, AllowHighFees: defaultAllowHighFees, RelayFee: cfgutil.NewAmountFlag(txrules.DefaultRelayFeePerKb), - PoolAddress: cfgutil.NewAddressFlag(), AccountGapLimit: defaultAccountGapLimit, DisableCoinTypeUpgrades: defaultDisableCoinTypeUpgrades, CircuitLimit: defaultCircuitLimit, @@ -556,7 +552,6 @@ func loadConfig(ctx context.Context) (*config, []string, error) { flag *cfgutil.AddressFlag addr *stdaddr.StakeAddress }{ - {cfg.PoolAddress, &cfg.poolAddress}, {cfg.TBOpts.VotingAddress, &cfg.TBOpts.votingAddress}, } { addr, err := a.flag.StakeAddress(activeNet.Params) @@ -692,15 +687,6 @@ func loadConfig(ctx context.Context) (*config, []string, error) { return loadConfigError(err) } - if cfg.PoolFees != 0.0 { - if !txrules.ValidPoolFeeRate(cfg.PoolFees) { - err := errors.E(errors.Invalid, errors.Errorf("pool fee rate %v", cfg.PoolFees)) - fmt.Fprintln(os.Stderr, err.Error()) - fmt.Fprintln(os.Stderr, usageMessage) - return loadConfigError(err) - } - } - ipNet := func(cidr string) net.IPNet { _, ipNet, err := net.ParseCIDR(cidr) if err != nil { diff --git a/dcrwallet.go b/dcrwallet.go index b2e32e0f1..38eb48201 100644 --- a/dcrwallet.go +++ b/dcrwallet.go @@ -169,8 +169,6 @@ func run(ctx context.Context) error { stakeOptions := &ldr.StakeOptions{ VotingEnabled: cfg.EnableVoting, VotingAddress: cfg.TBOpts.votingAddress, - PoolAddress: cfg.poolAddress, - PoolFees: cfg.PoolFees, } loader := ldr.NewLoader(activeNet.Params, dbDir, stakeOptions, cfg.GapLimit, cfg.WatchLast, cfg.AllowHighFees, cfg.RelayFee.Amount, @@ -316,14 +314,11 @@ func run(ctx context.Context) error { changeAccount uint32 // (enableticketbuyer && mixing) || mixchange ticketSplitAccount uint32 // enableticketbuyer && mixing - votingAddr = cfg.TBOpts.votingAddress - poolFeeAddr = cfg.poolAddress + votingAddr = cfg.TBOpts.votingAddress ) if cfg.EnableTicketBuyer { purchaseAccount = lookup("purchaseaccount", cfg.PurchaseAccount) - if cfg.Mixing { - poolFeeAddr = nil - } + if cfg.Mixing && cfg.TBOpts.VotingAccount == "" { err := errors.New("cannot run mixed ticketbuyer without --votingaccount") log.Error(err) @@ -353,7 +348,6 @@ func run(ctx context.Context) error { c.Account = purchaseAccount c.Maintain = cfg.TBOpts.BalanceToMaintainAbsolute.Amount c.VotingAddr = votingAddr - c.PoolFeeAddr = poolFeeAddr c.Limit = int(cfg.TBOpts.Limit) c.VotingAccount = votingAccount c.Mixing = cfg.Mixing diff --git a/internal/loader/loader.go b/internal/loader/loader.go index 84cabbb3b..c1461b5b4 100644 --- a/internal/loader/loader.go +++ b/internal/loader/loader.go @@ -56,8 +56,6 @@ type Loader struct { type StakeOptions struct { VotingEnabled bool VotingAddress stdaddr.StakeAddress - PoolAddress stdaddr.StakeAddress - PoolFees float64 } // NewLoader constructs a Loader. @@ -177,8 +175,6 @@ func (l *Loader) CreateWatchingOnlyWallet(ctx context.Context, extendedPubKey st PubPassphrase: pubPass, VotingEnabled: so.VotingEnabled, VotingAddress: so.VotingAddress, - PoolAddress: so.PoolAddress, - PoolFees: so.PoolFees, GapLimit: l.gapLimit, WatchLast: l.watchLast, AccountGapLimit: l.accountGapLimit, @@ -269,8 +265,6 @@ func (l *Loader) CreateNewWallet(ctx context.Context, pubPassphrase, privPassphr PubPassphrase: pubPassphrase, VotingEnabled: so.VotingEnabled, VotingAddress: so.VotingAddress, - PoolAddress: so.PoolAddress, - PoolFees: so.PoolFees, GapLimit: l.gapLimit, WatchLast: l.watchLast, AccountGapLimit: l.accountGapLimit, @@ -329,8 +323,6 @@ func (l *Loader) OpenExistingWallet(ctx context.Context, pubPassphrase []byte) ( PubPassphrase: pubPassphrase, VotingEnabled: so.VotingEnabled, VotingAddress: so.VotingAddress, - PoolAddress: so.PoolAddress, - PoolFees: so.PoolFees, GapLimit: l.gapLimit, WatchLast: l.watchLast, AccountGapLimit: l.accountGapLimit, diff --git a/internal/rpc/jsonrpc/methods.go b/internal/rpc/jsonrpc/methods.go index 0aa7f81b6..f9c05465d 100644 --- a/internal/rpc/jsonrpc/methods.go +++ b/internal/rpc/jsonrpc/methods.go @@ -3313,29 +3313,6 @@ func (s *Server) purchaseTicket(ctx context.Context, icmd any) (any, error) { } } - // Set pool address if specified. - var poolAddr stdaddr.StakeAddress - var poolFee float64 - if cmd.PoolAddress != nil && *cmd.PoolAddress != "" { - addr, err := decodeStakeAddress(*cmd.PoolAddress, w.ChainParams()) - if err != nil { - return nil, err - } - poolAddr = addr - - // Attempt to get the amount to send to - // the pool after. - if cmd.PoolFees == nil { - return nil, rpcErrorf(dcrjson.ErrRPCInvalidParameter, - "pool address set without pool fee") - } - poolFee = *cmd.PoolFees - if !txrules.ValidPoolFeeRate(poolFee) { - return nil, rpcErrorf(dcrjson.ErrRPCInvalidParameter, - "pool fee percentage %v", poolFee) - } - } - // Set the expiry if specified. expiry := int32(0) if cmd.Expiry != nil { @@ -3405,8 +3382,6 @@ func (s *Server) purchaseTicket(ctx context.Context, icmd any) (any, error) { MinConf: minConf, Expiry: expiry, DontSignTx: dontSignTx, - VSPAddress: poolAddr, - VSPFees: poolFee, // CSPP Mixing: mixing, diff --git a/internal/rpc/jsonrpc/rpcserverhelp.go b/internal/rpc/jsonrpc/rpcserverhelp.go index c2eca3b2b..3ef7eeb28 100644 --- a/internal/rpc/jsonrpc/rpcserverhelp.go +++ b/internal/rpc/jsonrpc/rpcserverhelp.go @@ -68,7 +68,7 @@ func helpDescsEnUS() map[string]string { "mixaccount": "mixaccount\n\nMix all outputs of an account.\n\nArguments:\nNone\n\nResult:\nNothing\n", "mixoutput": "mixoutput \"outpoint\"\n\nMix a specific output.\n\nArguments:\n1. outpoint (string, required) Outpoint (in form \"txhash:index\") to mix\n\nResult:\nNothing\n", "processunmanagedticket": "processunmanagedticket \"tickethash\"\n\nProcesses tickets for vsp client based on ticket hash.\n\nArguments:\n1. tickethash (string, required) The ticket hash of ticket to be processed by the vsp client.\n\nResult:\nNothing\n", - "purchaseticket": "purchaseticket \"fromaccount\" spendlimit (minconf=1 \"ticketaddress\" numtickets=1 \"pooladdress\" poolfees expiry \"comment\" dontsigntx)\n\nPurchase ticket using available funds.\n\nArguments:\n1. fromaccount (string, required) The account to use for purchase (default=\"default\")\n2. spendlimit (numeric, required) Limit on the amount to spend on ticket\n3. minconf (numeric, optional, default=1) Minimum number of block confirmations required\n4. ticketaddress (string, optional) Override the ticket address to which voting rights are given\n5. numtickets (numeric, optional, default=1) The number of tickets to purchase\n6. pooladdress (string, optional) The address to pay stake pool fees to\n7. poolfees (numeric, optional) The amount of fees to pay to the stake pool\n8. expiry (numeric, optional) Height at which the purchase tickets expire\n9. comment (string, optional) Unused\n10. dontsigntx (boolean, optional) Return unsigned split and ticket transactions instead of signing and publishing\n\nResult:\n\"value\" (string) Hash of the resulting ticket\n", + "purchaseticket": "purchaseticket \"fromaccount\" spendlimit (minconf=1 \"ticketaddress\" numtickets=1 expiry \"comment\" dontsigntx)\n\nPurchase ticket using available funds.\n\nArguments:\n1. fromaccount (string, required) The account to use for purchase (default=\"default\")\n2. spendlimit (numeric, required) Limit on the amount to spend on ticket\n3. minconf (numeric, optional, default=1) Minimum number of block confirmations required\n4. ticketaddress (string, optional) Override the ticket address to which voting rights are given\n5. numtickets (numeric, optional, default=1) The number of tickets to purchase\n6. expiry (numeric, optional) Height at which the purchase tickets expire\n7. comment (string, optional) Unused\n8. dontsigntx (boolean, optional) Return unsigned split and ticket transactions instead of signing and publishing\n\nResult:\n\"value\" (string) Hash of the resulting ticket\n", "redeemmultisigout": "redeemmultisigout \"hash\" index tree (\"address\")\n\nTakes the input and constructs a P2PKH paying to the specified address.\n\nArguments:\n1. hash (string, required) Hash of the input transaction\n2. index (numeric, required) Idx of the input transaction\n3. tree (numeric, required) Tree the transaction is on.\n4. address (string, optional) Address to pay to.\n\nResult:\n{\n \"hex\": \"value\", (string) Resulting hash.\n \"complete\": true|false, (boolean) Shows if opperation was completed.\n \"errors\": [{ (array of object) Any errors generated.\n \"txid\": \"value\", (string) The transaction hash of the referenced previous output\n \"vout\": n, (numeric) The output index of the referenced previous output\n \"scriptSig\": \"value\", (string) The hex-encoded signature script\n \"sequence\": n, (numeric) Script sequence number\n \"error\": \"value\", (string) Verification or signing error related to the input\n },...], \n} \n", "redeemmultisigouts": "redeemmultisigouts \"fromscraddress\" (\"toaddress\" number)\n\nTakes a hash, looks up all unspent outpoints and generates list artially signed transactions spending to either an address specified or internal addresses\n\nArguments:\n1. fromscraddress (string, required) Input script hash address.\n2. toaddress (string, optional) Address to look for (if not internal addresses).\n3. number (numeric, optional) Number of outpoints found.\n\nResult:\n{\n \"hex\": \"value\", (string) Resulting hash.\n \"complete\": true|false, (boolean) Shows if opperation was completed.\n \"errors\": [{ (array of object) Any errors generated.\n \"txid\": \"value\", (string) The transaction hash of the referenced previous output\n \"vout\": n, (numeric) The output index of the referenced previous output\n \"scriptSig\": \"value\", (string) The hex-encoded signature script\n \"sequence\": n, (numeric) Script sequence number\n \"error\": \"value\", (string) Verification or signing error related to the input\n },...], \n} \n", "renameaccount": "renameaccount \"oldaccount\" \"newaccount\"\n\nRenames an account.\n\nArguments:\n1. oldaccount (string, required) The old account name to rename\n2. newaccount (string, required) The new name for the account\n\nResult:\nNothing\n", @@ -113,4 +113,4 @@ var localeHelpDescs = map[string]func() map[string]string{ "en_US": helpDescsEnUS, } -var requestUsages = "abandontransaction \"hash\"\naccountaddressindex \"account\" branch\naccountsyncaddressindex \"account\" branch index\naccountunlocked \"account\"\naddmultisigaddress nrequired [\"key\",...] (\"account\")\naddtransaction \"blockhash\" \"transaction\"\nauditreuse (since)\nconsolidate inputs (\"account\" \"address\")\ncreatemultisig nrequired [\"key\",...]\ncreatenewaccount \"account\"\ncreaterawtransaction [{\"amount\":n.nnn,\"txid\":\"value\",\"vout\":n,\"tree\":n},...] {\"address\":amount,...} (locktime expiry)\ncreatesignature \"address\" inputindex hashtype \"previouspkscript\" \"serializedtransaction\"\ndisapprovepercent\ndiscoverusage (\"startblock\" discoveraccounts gaplimit)\ndumpprivkey \"address\"\nfundrawtransaction \"hexstring\" \"fundaccount\" ({\"changeaddress\":changeaddress,\"feerate\":feerate,\"conftarget\":conftarget})\ngetaccount \"address\"\ngetaccountaddress \"account\"\ngetaddressesbyaccount \"account\"\ngetbalance (\"account\" minconf=1)\ngetbestblock\ngetbestblockhash\ngetblockcount\ngetblockhash index\ngetblockheader \"hash\" (verbose=true)\ngetblock \"hash\" (verbose=true verbosetx=false)\ngetcoinjoinsbyacct\ngetcurrentnet\ngetinfo\ngetmasterpubkey (\"account\")\ngetmultisigoutinfo \"hash\" index\ngetnewaddress (\"account\" \"gappolicy\")\ngetpeerinfo\ngetrawchangeaddress (\"account\")\ngetreceivedbyaccount \"account\" (minconf=1)\ngetreceivedbyaddress \"address\" (minconf=1)\ngetstakeinfo\ngettickets includeimmature\ngettransaction \"txid\" (includewatchonly=false)\ngettxout \"txid\" vout tree (includemempool=true)\ngetunconfirmedbalance (\"account\")\ngetvotechoices (\"tickethash\")\ngetwalletfee\ngetcfilterv2 \"blockhash\"\nhelp (\"command\")\nimportcfiltersv2 startheight [\"filter\",...]\nimportprivkey \"privkey\" (\"label\" rescan=true scanfrom)\nimportpubkey \"pubkey\" (\"label\" rescan=true scanfrom)\nimportscript \"hex\" (rescan=true scanfrom)\nimportxpub \"name\" \"xpub\"\nlistaccounts (minconf=1)\nlistaddresstransactions [\"address\",...] (\"account\")\nlistalltransactions (\"account\")\nlistlockunspent (\"account\")\nlistreceivedbyaccount (minconf=1 includeempty=false includewatchonly=false)\nlistreceivedbyaddress (minconf=1 includeempty=false includewatchonly=false)\nlistsinceblock (\"blockhash\" targetconfirmations=1 includewatchonly=false)\nlisttransactions (\"account\" count=10 from=0 includewatchonly=false)\nlistunspent (minconf=1 maxconf=9999999 [\"address\",...] \"account\")\nlockaccount \"account\"\nlockunspent unlock [{\"amount\":n.nnn,\"txid\":\"value\",\"vout\":n,\"tree\":n},...]\nmixaccount\nmixoutput \"outpoint\"\nprocessunmanagedticket \"tickethash\"\npurchaseticket \"fromaccount\" spendlimit (minconf=1 \"ticketaddress\" numtickets=1 \"pooladdress\" poolfees expiry \"comment\" dontsigntx)\nredeemmultisigout \"hash\" index tree (\"address\")\nredeemmultisigouts \"fromscraddress\" (\"toaddress\" number)\nrenameaccount \"oldaccount\" \"newaccount\"\nrescanwallet (beginheight=0)\nsendfrom \"fromaccount\" \"toaddress\" amount (minconf=1 \"comment\" \"commentto\")\nsendfromtreasury \"key\" amounts\nsendmany \"fromaccount\" {\"address\":amount,...} (minconf=1 \"comment\")\nsendrawtransaction \"hextx\" (allowhighfees=false)\nsendtoaddress \"address\" amount (\"comment\" \"commentto\")\nsendtomultisig \"fromaccount\" amount [\"pubkey\",...] (nrequired=1 minconf=1 \"comment\")\nsendtotreasury amount\nsetaccountpassphrase \"account\" \"passphrase\"\nsetdisapprovepercent percent\nsettreasurypolicy \"key\" \"policy\" (\"ticket\")\nsettspendpolicy \"hash\" \"policy\" (\"ticket\")\nsettxfee amount\nsetvotechoice \"agendaid\" \"choiceid\" (\"tickethash\")\nsignmessage \"address\" \"message\"\nsignrawtransaction \"rawtx\" ([{\"txid\":\"value\",\"vout\":n,\"tree\":n,\"scriptpubkey\":\"value\",\"redeemscript\":\"value\"},...] [\"privkey\",...] flags=\"ALL\")\nsignrawtransactions [\"rawtx\",...] (send=true)\nspendoutputs \"account\" [\"previousoutpoint\",...] [{\"address\":\"value\",\"amount\":n.nnn},...]\nsweepaccount \"sourceaccount\" \"destinationaddress\" (requiredconfirmations feeperkb)\nsyncstatus\nticketinfo (startheight=0)\ntreasurypolicy (\"key\" \"ticket\")\ntspendpolicy (\"hash\" \"ticket\")\nunlockaccount \"account\" \"passphrase\"\nvalidateaddress \"address\"\nvalidatepredcp0005cf\nverifymessage \"address\" \"signature\" \"message\"\nversion\nwalletinfo\nwalletislocked\nwalletlock\nwalletpassphrase \"passphrase\" timeout\nwalletpassphrasechange \"oldpassphrase\" \"newpassphrase\"\nwalletpubpassphrasechange \"oldpassphrase\" \"newpassphrase\"" +var requestUsages = "abandontransaction \"hash\"\naccountaddressindex \"account\" branch\naccountsyncaddressindex \"account\" branch index\naccountunlocked \"account\"\naddmultisigaddress nrequired [\"key\",...] (\"account\")\naddtransaction \"blockhash\" \"transaction\"\nauditreuse (since)\nconsolidate inputs (\"account\" \"address\")\ncreatemultisig nrequired [\"key\",...]\ncreatenewaccount \"account\"\ncreaterawtransaction [{\"amount\":n.nnn,\"txid\":\"value\",\"vout\":n,\"tree\":n},...] {\"address\":amount,...} (locktime expiry)\ncreatesignature \"address\" inputindex hashtype \"previouspkscript\" \"serializedtransaction\"\ndisapprovepercent\ndiscoverusage (\"startblock\" discoveraccounts gaplimit)\ndumpprivkey \"address\"\nfundrawtransaction \"hexstring\" \"fundaccount\" ({\"changeaddress\":changeaddress,\"feerate\":feerate,\"conftarget\":conftarget})\ngetaccount \"address\"\ngetaccountaddress \"account\"\ngetaddressesbyaccount \"account\"\ngetbalance (\"account\" minconf=1)\ngetbestblock\ngetbestblockhash\ngetblockcount\ngetblockhash index\ngetblockheader \"hash\" (verbose=true)\ngetblock \"hash\" (verbose=true verbosetx=false)\ngetcoinjoinsbyacct\ngetcurrentnet\ngetinfo\ngetmasterpubkey (\"account\")\ngetmultisigoutinfo \"hash\" index\ngetnewaddress (\"account\" \"gappolicy\")\ngetpeerinfo\ngetrawchangeaddress (\"account\")\ngetreceivedbyaccount \"account\" (minconf=1)\ngetreceivedbyaddress \"address\" (minconf=1)\ngetstakeinfo\ngettickets includeimmature\ngettransaction \"txid\" (includewatchonly=false)\ngettxout \"txid\" vout tree (includemempool=true)\ngetunconfirmedbalance (\"account\")\ngetvotechoices (\"tickethash\")\ngetwalletfee\ngetcfilterv2 \"blockhash\"\nhelp (\"command\")\nimportcfiltersv2 startheight [\"filter\",...]\nimportprivkey \"privkey\" (\"label\" rescan=true scanfrom)\nimportpubkey \"pubkey\" (\"label\" rescan=true scanfrom)\nimportscript \"hex\" (rescan=true scanfrom)\nimportxpub \"name\" \"xpub\"\nlistaccounts (minconf=1)\nlistaddresstransactions [\"address\",...] (\"account\")\nlistalltransactions (\"account\")\nlistlockunspent (\"account\")\nlistreceivedbyaccount (minconf=1 includeempty=false includewatchonly=false)\nlistreceivedbyaddress (minconf=1 includeempty=false includewatchonly=false)\nlistsinceblock (\"blockhash\" targetconfirmations=1 includewatchonly=false)\nlisttransactions (\"account\" count=10 from=0 includewatchonly=false)\nlistunspent (minconf=1 maxconf=9999999 [\"address\",...] \"account\")\nlockaccount \"account\"\nlockunspent unlock [{\"amount\":n.nnn,\"txid\":\"value\",\"vout\":n,\"tree\":n},...]\nmixaccount\nmixoutput \"outpoint\"\nprocessunmanagedticket \"tickethash\"\npurchaseticket \"fromaccount\" spendlimit (minconf=1 \"ticketaddress\" numtickets=1 expiry \"comment\" dontsigntx)\nredeemmultisigout \"hash\" index tree (\"address\")\nredeemmultisigouts \"fromscraddress\" (\"toaddress\" number)\nrenameaccount \"oldaccount\" \"newaccount\"\nrescanwallet (beginheight=0)\nsendfrom \"fromaccount\" \"toaddress\" amount (minconf=1 \"comment\" \"commentto\")\nsendfromtreasury \"key\" amounts\nsendmany \"fromaccount\" {\"address\":amount,...} (minconf=1 \"comment\")\nsendrawtransaction \"hextx\" (allowhighfees=false)\nsendtoaddress \"address\" amount (\"comment\" \"commentto\")\nsendtomultisig \"fromaccount\" amount [\"pubkey\",...] (nrequired=1 minconf=1 \"comment\")\nsendtotreasury amount\nsetaccountpassphrase \"account\" \"passphrase\"\nsetdisapprovepercent percent\nsettreasurypolicy \"key\" \"policy\" (\"ticket\")\nsettspendpolicy \"hash\" \"policy\" (\"ticket\")\nsettxfee amount\nsetvotechoice \"agendaid\" \"choiceid\" (\"tickethash\")\nsignmessage \"address\" \"message\"\nsignrawtransaction \"rawtx\" ([{\"txid\":\"value\",\"vout\":n,\"tree\":n,\"scriptpubkey\":\"value\",\"redeemscript\":\"value\"},...] [\"privkey\",...] flags=\"ALL\")\nsignrawtransactions [\"rawtx\",...] (send=true)\nspendoutputs \"account\" [\"previousoutpoint\",...] [{\"address\":\"value\",\"amount\":n.nnn},...]\nsweepaccount \"sourceaccount\" \"destinationaddress\" (requiredconfirmations feeperkb)\nsyncstatus\nticketinfo (startheight=0)\ntreasurypolicy (\"key\" \"ticket\")\ntspendpolicy (\"hash\" \"ticket\")\nunlockaccount \"account\" \"passphrase\"\nvalidateaddress \"address\"\nvalidatepredcp0005cf\nverifymessage \"address\" \"signature\" \"message\"\nversion\nwalletinfo\nwalletislocked\nwalletlock\nwalletpassphrase \"passphrase\" timeout\nwalletpassphrasechange \"oldpassphrase\" \"newpassphrase\"\nwalletpubpassphrasechange \"oldpassphrase\" \"newpassphrase\"" diff --git a/internal/rpc/rpcserver/server.go b/internal/rpc/rpcserver/server.go index 076f4b7a2..c81d3fbe3 100644 --- a/internal/rpc/rpcserver/server.go +++ b/internal/rpc/rpcserver/server.go @@ -1811,19 +1811,6 @@ func (s *walletServer) PurchaseTickets(ctx context.Context, } } - var poolAddr stdaddr.StakeAddress - var poolFees float64 - if req.PoolAddress != "" { - if req.VspHost != "" || req.VspPubkey != "" { - return nil, status.Errorf(codes.InvalidArgument, - "request contains both legacy stakepoold and vspd options.") - } - poolAddr, err = decodeStakeAddress(req.PoolAddress, params) - if err != nil { - return nil, err - } - } - // new vspd request var vspHost string var vspPubKey string @@ -1855,23 +1842,6 @@ func (s *walletServer) PurchaseTickets(ctx context.Context, } } - if req.PoolFees > 0 { - poolFees = req.PoolFees - if !txrules.ValidPoolFeeRate(req.PoolFees) { - return nil, status.Errorf(codes.InvalidArgument, "Invalid pool fees percentage") - } - } - - if poolFees > 0 && poolAddr == nil { - return nil, status.Errorf(codes.InvalidArgument, - "Pool fees set but no pool address given") - } - - if poolFees <= 0 && poolAddr != nil { - return nil, status.Errorf(codes.InvalidArgument, - "Pool fees negative or unset but pool address given") - } - numTickets := int(req.NumTickets) if numTickets < 1 { return nil, status.Errorf(codes.InvalidArgument, @@ -1927,8 +1897,6 @@ func (s *walletServer) PurchaseTickets(ctx context.Context, MinConf: minConf, Expiry: expiry, DontSignTx: dontSignTx, - VSPAddress: poolAddr, - VSPFees: poolFees, UseVotingAccount: req.UseVotingAccount, VotingAccount: req.VotingAccount, @@ -2673,18 +2641,6 @@ func (t *ticketbuyerV2Server) RunTicketBuyer(req *pb.RunTicketBuyerRequest, svr return err } } - var poolAddress stdaddr.StakeAddress - if req.PoolAddress != "" { - if req.VspHost != "" || req.VspPubkey != "" { - return status.Errorf(codes.InvalidArgument, - "request contains both legacy stakepoold and vspd options.") - } - poolAddress, err = decodeStakeAddress(req.PoolAddress, params) - if err != nil { - return err - } - } - // new vspd request var vspHost string var vspPubKey string @@ -2765,8 +2721,6 @@ func (t *ticketbuyerV2Server) RunTicketBuyer(req *pb.RunTicketBuyerRequest, svr c.VotingAccount = req.VotingAccount c.Maintain = dcrutil.Amount(req.BalanceToMaintain) c.VotingAddr = votingAddress - c.PoolFeeAddr = poolAddress - c.PoolFees = req.PoolFees c.VSP = vspClient c.Mixing = csppServer != "" c.MixedAccount = mixedAccount diff --git a/internal/rpchelp/helpdescs_en_US.go b/internal/rpchelp/helpdescs_en_US.go index 582058bde..c93d39b54 100644 --- a/internal/rpchelp/helpdescs_en_US.go +++ b/internal/rpchelp/helpdescs_en_US.go @@ -677,8 +677,6 @@ var helpDescsEnUS = map[string]string{ "purchaseticket-minconf": "Minimum number of block confirmations required", "purchaseticket-ticketaddress": "Override the ticket address to which voting rights are given", "purchaseticket-numtickets": "The number of tickets to purchase", - "purchaseticket-pooladdress": "The address to pay stake pool fees to", - "purchaseticket-poolfees": "The amount of fees to pay to the stake pool", "purchaseticket-expiry": "Height at which the purchase tickets expire", "purchaseticket-nosplittransaction": "Use ticket purchase change outputs instead of a split transaction", "purchaseticket-comment": "Unused", diff --git a/rpc/api.proto b/rpc/api.proto index a86e27d4a..84b9e6951 100644 --- a/rpc/api.proto +++ b/rpc/api.proto @@ -648,21 +648,19 @@ message PurchaseTicketsRequest { uint32 required_confirmations = 4; string ticket_address = 5; uint32 num_tickets = 6; - string pool_address = 7; - double pool_fees = 8; - uint32 expiry = 9; - int64 tx_fee = 10; - int64 ticket_fee = 11; - bool dont_sign_tx = 12; - string cspp_server = 13; - uint32 mixed_account = 14; - uint32 mixed_account_branch = 15; - uint32 mixed_split_account = 16; - uint32 change_account = 17; - string vsp_host = 18; - string vsp_pubkey = 19; - bool use_voting_account = 20; - uint32 voting_account = 21; + uint32 expiry = 7; + int64 tx_fee = 8; + int64 ticket_fee = 9; + bool dont_sign_tx = 10; + string cspp_server = 11; + uint32 mixed_account = 12; + uint32 mixed_account_branch = 13; + uint32 mixed_split_account = 14; + uint32 change_account = 15; + string vsp_host = 16; + string vsp_pubkey = 17; + bool use_voting_account = 18; + uint32 voting_account = 19; } message PurchaseTicketsResponse { repeated bytes ticket_hashes = 1; @@ -913,16 +911,14 @@ message RunTicketBuyerRequest { uint32 voting_account = 3; int64 balance_to_maintain = 4; string voting_address = 5; - string pool_address = 6; - double pool_fees = 7; - string vsp_host = 8; - string vsp_pubkey = 9; - int32 limit = 10; - string cspp_server = 11; - uint32 mixed_account = 12; - uint32 mixed_account_branch = 13; - uint32 mixed_split_account = 14; - uint32 change_account = 15; + string vsp_host = 6; + string vsp_pubkey = 7; + int32 limit = 8; + string cspp_server = 9; + uint32 mixed_account = 10; + uint32 mixed_account_branch = 11; + uint32 mixed_split_account = 12; + uint32 change_account = 13; } message RunTicketBuyerResponse {} diff --git a/rpc/client/dcrwallet/methods.go b/rpc/client/dcrwallet/methods.go index 29353cb07..6fe48ec94 100644 --- a/rpc/client/dcrwallet/methods.go +++ b/rpc/client/dcrwallet/methods.go @@ -245,8 +245,8 @@ func (c *Client) SendManyMinConf(ctx context.Context, fromAccount string, amount // parameter. func (c *Client) PurchaseTicket(ctx context.Context, fromAccount string, spendLimit dcrutil.Amount, minConf *int, ticketAddress stdaddr.Address, - numTickets *int, poolAddress stdaddr.Address, poolFees *dcrutil.Amount, - expiry *int, ticketChange *bool, ticketFee *dcrutil.Amount) ([]*chainhash.Hash, error) { + numTickets *int, expiry *int, ticketChange *bool, + ticketFee *dcrutil.Amount) ([]*chainhash.Hash, error) { params := make([]any, 2, 10) params[0] = fromAccount @@ -268,8 +268,6 @@ func (c *Client) PurchaseTicket(ctx context.Context, fromAccount string, addParam(minConf != nil, func() any { return *minConf }) addParam(ticketAddress != nil, func() any { return ticketAddress.String() }) addParam(numTickets != nil, func() any { return *numTickets }) - addParam(poolAddress != nil, func() any { return poolAddress.String() }) - addParam(poolFees != nil, func() any { return poolFees.ToCoin() }) addParam(expiry != nil, func() any { return *expiry }) addParam(ticketChange != nil, func() any { return *ticketChange }) addParam(ticketFee != nil, func() any { return ticketFee.ToCoin() }) diff --git a/rpc/documentation/api.md b/rpc/documentation/api.md index 1e0c84b81..a6d0ed0c6 100644 --- a/rpc/documentation/api.md +++ b/rpc/documentation/api.md @@ -1733,10 +1733,10 @@ ___ The `PurchaseTickets` method is used to purchase tickets. It can use a specified address for voting rights, and can additionally be used in conjunction with a -stake pool. An expiration value can be set for the tickets. Expired tickets are +VSP. An expiration value can be set for the tickets. Expired tickets are pruned from the wallet and funds and then restored to the user. The following fields can be left unset, and unset (empty or zero) behavior is given below: -ticker_address, pool_address, expiry, tx_fee, ticket_fee. +ticket_address, expiry, tx_fee, ticket_fee. **Request:** `PurchaseTicketsRequest` @@ -1757,13 +1757,6 @@ ticker_address, pool_address, expiry, tx_fee, ticket_fee. - `uint32 num_tickets`: The number of tickets to purchase. It must be set and at least 1. -- `string pool_address`: The address of the stake pool used. Pool mode will - be disabled if an empty string is passed. - -- `double pool_fees`: The stake pool fees amount. This must be set to a positive - value in the allowed range of 0.01 to 100.00 to be valid. It must be set when - the pool_address is also set. - - `uint32 expiry`: The height at which the tickets expire and can no longer enter the blockchain. It defaults to 0 (no expiry). @@ -3136,7 +3129,7 @@ launch the V2 ticket buyer. #### `RunTicketBuyer` The `RunTicketBuyer` starts a new V2 ticket buyer for the specified account. -The users may specify a balance to maintain as well as various settings for purchasing tickets for stakepools. +The users may specify a balance to maintain. **Request:** `RunTicketBuyerRequest` @@ -3150,10 +3143,6 @@ The users may specify a balance to maintain as well as various settings for purc - `string voting_address`: The address to give the tickets purchased voting rights. -- `string pool_address`: The address that will be used in any stakepool fee commitment utxos. - -- `double pool_fees`: The percentage used to calculate the proper fee in the stakepool fee commitment utxos. - **Response:** `stream RunTicketBuyerResponse` **Expected errors:** diff --git a/rpc/jsonrpc/types/methods.go b/rpc/jsonrpc/types/methods.go index 57b9589cd..de55231c2 100644 --- a/rpc/jsonrpc/types/methods.go +++ b/rpc/jsonrpc/types/methods.go @@ -682,8 +682,6 @@ type PurchaseTicketCmd struct { MinConf *int `jsonrpcdefault:"1"` TicketAddress *string NumTickets *int `jsonrpcdefault:"1"` - PoolAddress *string - PoolFees *float64 Expiry *int Comment *string DontSignTx *bool @@ -691,7 +689,7 @@ type PurchaseTicketCmd struct { // NewPurchaseTicketCmd creates a new PurchaseTicketCmd. func NewPurchaseTicketCmd(fromAccount string, spendLimit float64, minConf *int, - ticketAddress *string, numTickets *int, poolAddress *string, poolFees *float64, + ticketAddress *string, numTickets *int, expiry *int, comment *string) *PurchaseTicketCmd { return &PurchaseTicketCmd{ FromAccount: fromAccount, @@ -699,8 +697,6 @@ func NewPurchaseTicketCmd(fromAccount string, spendLimit float64, minConf *int, MinConf: minConf, TicketAddress: ticketAddress, NumTickets: numTickets, - PoolAddress: poolAddress, - PoolFees: poolFees, Expiry: expiry, Comment: comment, } diff --git a/rpc/walletrpc/api.pb.go b/rpc/walletrpc/api.pb.go index c3896843e..3bbdb6c60 100644 --- a/rpc/walletrpc/api.pb.go +++ b/rpc/walletrpc/api.pb.go @@ -5036,27 +5036,25 @@ type PurchaseTicketsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Passphrase []byte `protobuf:"bytes,1,opt,name=passphrase,proto3" json:"passphrase,omitempty"` - Account uint32 `protobuf:"varint,2,opt,name=account,proto3" json:"account,omitempty"` - SpendLimit int64 `protobuf:"varint,3,opt,name=spend_limit,json=spendLimit,proto3" json:"spend_limit,omitempty"` - RequiredConfirmations uint32 `protobuf:"varint,4,opt,name=required_confirmations,json=requiredConfirmations,proto3" json:"required_confirmations,omitempty"` - TicketAddress string `protobuf:"bytes,5,opt,name=ticket_address,json=ticketAddress,proto3" json:"ticket_address,omitempty"` - NumTickets uint32 `protobuf:"varint,6,opt,name=num_tickets,json=numTickets,proto3" json:"num_tickets,omitempty"` - PoolAddress string `protobuf:"bytes,7,opt,name=pool_address,json=poolAddress,proto3" json:"pool_address,omitempty"` - PoolFees float64 `protobuf:"fixed64,8,opt,name=pool_fees,json=poolFees,proto3" json:"pool_fees,omitempty"` - Expiry uint32 `protobuf:"varint,9,opt,name=expiry,proto3" json:"expiry,omitempty"` - TxFee int64 `protobuf:"varint,10,opt,name=tx_fee,json=txFee,proto3" json:"tx_fee,omitempty"` - TicketFee int64 `protobuf:"varint,11,opt,name=ticket_fee,json=ticketFee,proto3" json:"ticket_fee,omitempty"` - DontSignTx bool `protobuf:"varint,12,opt,name=dont_sign_tx,json=dontSignTx,proto3" json:"dont_sign_tx,omitempty"` - CsppServer string `protobuf:"bytes,13,opt,name=cspp_server,json=csppServer,proto3" json:"cspp_server,omitempty"` - MixedAccount uint32 `protobuf:"varint,14,opt,name=mixed_account,json=mixedAccount,proto3" json:"mixed_account,omitempty"` - MixedAccountBranch uint32 `protobuf:"varint,15,opt,name=mixed_account_branch,json=mixedAccountBranch,proto3" json:"mixed_account_branch,omitempty"` - MixedSplitAccount uint32 `protobuf:"varint,16,opt,name=mixed_split_account,json=mixedSplitAccount,proto3" json:"mixed_split_account,omitempty"` - ChangeAccount uint32 `protobuf:"varint,17,opt,name=change_account,json=changeAccount,proto3" json:"change_account,omitempty"` - VspHost string `protobuf:"bytes,18,opt,name=vsp_host,json=vspHost,proto3" json:"vsp_host,omitempty"` - VspPubkey string `protobuf:"bytes,19,opt,name=vsp_pubkey,json=vspPubkey,proto3" json:"vsp_pubkey,omitempty"` - UseVotingAccount bool `protobuf:"varint,20,opt,name=use_voting_account,json=useVotingAccount,proto3" json:"use_voting_account,omitempty"` - VotingAccount uint32 `protobuf:"varint,21,opt,name=voting_account,json=votingAccount,proto3" json:"voting_account,omitempty"` + Passphrase []byte `protobuf:"bytes,1,opt,name=passphrase,proto3" json:"passphrase,omitempty"` + Account uint32 `protobuf:"varint,2,opt,name=account,proto3" json:"account,omitempty"` + SpendLimit int64 `protobuf:"varint,3,opt,name=spend_limit,json=spendLimit,proto3" json:"spend_limit,omitempty"` + RequiredConfirmations uint32 `protobuf:"varint,4,opt,name=required_confirmations,json=requiredConfirmations,proto3" json:"required_confirmations,omitempty"` + TicketAddress string `protobuf:"bytes,5,opt,name=ticket_address,json=ticketAddress,proto3" json:"ticket_address,omitempty"` + NumTickets uint32 `protobuf:"varint,6,opt,name=num_tickets,json=numTickets,proto3" json:"num_tickets,omitempty"` + Expiry uint32 `protobuf:"varint,7,opt,name=expiry,proto3" json:"expiry,omitempty"` + TxFee int64 `protobuf:"varint,8,opt,name=tx_fee,json=txFee,proto3" json:"tx_fee,omitempty"` + TicketFee int64 `protobuf:"varint,9,opt,name=ticket_fee,json=ticketFee,proto3" json:"ticket_fee,omitempty"` + DontSignTx bool `protobuf:"varint,10,opt,name=dont_sign_tx,json=dontSignTx,proto3" json:"dont_sign_tx,omitempty"` + CsppServer string `protobuf:"bytes,11,opt,name=cspp_server,json=csppServer,proto3" json:"cspp_server,omitempty"` + MixedAccount uint32 `protobuf:"varint,12,opt,name=mixed_account,json=mixedAccount,proto3" json:"mixed_account,omitempty"` + MixedAccountBranch uint32 `protobuf:"varint,13,opt,name=mixed_account_branch,json=mixedAccountBranch,proto3" json:"mixed_account_branch,omitempty"` + MixedSplitAccount uint32 `protobuf:"varint,14,opt,name=mixed_split_account,json=mixedSplitAccount,proto3" json:"mixed_split_account,omitempty"` + ChangeAccount uint32 `protobuf:"varint,15,opt,name=change_account,json=changeAccount,proto3" json:"change_account,omitempty"` + VspHost string `protobuf:"bytes,16,opt,name=vsp_host,json=vspHost,proto3" json:"vsp_host,omitempty"` + VspPubkey string `protobuf:"bytes,17,opt,name=vsp_pubkey,json=vspPubkey,proto3" json:"vsp_pubkey,omitempty"` + UseVotingAccount bool `protobuf:"varint,18,opt,name=use_voting_account,json=useVotingAccount,proto3" json:"use_voting_account,omitempty"` + VotingAccount uint32 `protobuf:"varint,19,opt,name=voting_account,json=votingAccount,proto3" json:"voting_account,omitempty"` } func (x *PurchaseTicketsRequest) Reset() { @@ -5133,20 +5131,6 @@ func (x *PurchaseTicketsRequest) GetNumTickets() uint32 { return 0 } -func (x *PurchaseTicketsRequest) GetPoolAddress() string { - if x != nil { - return x.PoolAddress - } - return "" -} - -func (x *PurchaseTicketsRequest) GetPoolFees() float64 { - if x != nil { - return x.PoolFees - } - return 0 -} - func (x *PurchaseTicketsRequest) GetExpiry() uint32 { if x != nil { return x.Expiry @@ -7897,21 +7881,19 @@ type RunTicketBuyerRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Passphrase []byte `protobuf:"bytes,1,opt,name=passphrase,proto3" json:"passphrase,omitempty"` - Account uint32 `protobuf:"varint,2,opt,name=account,proto3" json:"account,omitempty"` - VotingAccount uint32 `protobuf:"varint,3,opt,name=voting_account,json=votingAccount,proto3" json:"voting_account,omitempty"` - BalanceToMaintain int64 `protobuf:"varint,4,opt,name=balance_to_maintain,json=balanceToMaintain,proto3" json:"balance_to_maintain,omitempty"` - VotingAddress string `protobuf:"bytes,5,opt,name=voting_address,json=votingAddress,proto3" json:"voting_address,omitempty"` - PoolAddress string `protobuf:"bytes,6,opt,name=pool_address,json=poolAddress,proto3" json:"pool_address,omitempty"` - PoolFees float64 `protobuf:"fixed64,7,opt,name=pool_fees,json=poolFees,proto3" json:"pool_fees,omitempty"` - VspHost string `protobuf:"bytes,8,opt,name=vsp_host,json=vspHost,proto3" json:"vsp_host,omitempty"` - VspPubkey string `protobuf:"bytes,9,opt,name=vsp_pubkey,json=vspPubkey,proto3" json:"vsp_pubkey,omitempty"` - Limit int32 `protobuf:"varint,10,opt,name=limit,proto3" json:"limit,omitempty"` - CsppServer string `protobuf:"bytes,11,opt,name=cspp_server,json=csppServer,proto3" json:"cspp_server,omitempty"` - MixedAccount uint32 `protobuf:"varint,12,opt,name=mixed_account,json=mixedAccount,proto3" json:"mixed_account,omitempty"` - MixedAccountBranch uint32 `protobuf:"varint,13,opt,name=mixed_account_branch,json=mixedAccountBranch,proto3" json:"mixed_account_branch,omitempty"` - MixedSplitAccount uint32 `protobuf:"varint,14,opt,name=mixed_split_account,json=mixedSplitAccount,proto3" json:"mixed_split_account,omitempty"` - ChangeAccount uint32 `protobuf:"varint,15,opt,name=change_account,json=changeAccount,proto3" json:"change_account,omitempty"` + Passphrase []byte `protobuf:"bytes,1,opt,name=passphrase,proto3" json:"passphrase,omitempty"` + Account uint32 `protobuf:"varint,2,opt,name=account,proto3" json:"account,omitempty"` + VotingAccount uint32 `protobuf:"varint,3,opt,name=voting_account,json=votingAccount,proto3" json:"voting_account,omitempty"` + BalanceToMaintain int64 `protobuf:"varint,4,opt,name=balance_to_maintain,json=balanceToMaintain,proto3" json:"balance_to_maintain,omitempty"` + VotingAddress string `protobuf:"bytes,5,opt,name=voting_address,json=votingAddress,proto3" json:"voting_address,omitempty"` + VspHost string `protobuf:"bytes,6,opt,name=vsp_host,json=vspHost,proto3" json:"vsp_host,omitempty"` + VspPubkey string `protobuf:"bytes,7,opt,name=vsp_pubkey,json=vspPubkey,proto3" json:"vsp_pubkey,omitempty"` + Limit int32 `protobuf:"varint,8,opt,name=limit,proto3" json:"limit,omitempty"` + CsppServer string `protobuf:"bytes,9,opt,name=cspp_server,json=csppServer,proto3" json:"cspp_server,omitempty"` + MixedAccount uint32 `protobuf:"varint,10,opt,name=mixed_account,json=mixedAccount,proto3" json:"mixed_account,omitempty"` + MixedAccountBranch uint32 `protobuf:"varint,11,opt,name=mixed_account_branch,json=mixedAccountBranch,proto3" json:"mixed_account_branch,omitempty"` + MixedSplitAccount uint32 `protobuf:"varint,12,opt,name=mixed_split_account,json=mixedSplitAccount,proto3" json:"mixed_split_account,omitempty"` + ChangeAccount uint32 `protobuf:"varint,13,opt,name=change_account,json=changeAccount,proto3" json:"change_account,omitempty"` } func (x *RunTicketBuyerRequest) Reset() { @@ -7981,20 +7963,6 @@ func (x *RunTicketBuyerRequest) GetVotingAddress() string { return "" } -func (x *RunTicketBuyerRequest) GetPoolAddress() string { - if x != nil { - return x.PoolAddress - } - return "" -} - -func (x *RunTicketBuyerRequest) GetPoolFees() float64 { - if x != nil { - return x.PoolFees - } - return 0 -} - func (x *RunTicketBuyerRequest) GetVspHost() string { if x != nil { return x.VspHost @@ -15875,7 +15843,7 @@ var file_api_proto_rawDesc = []byte{ 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x24, 0x0a, 0x22, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x55, 0x6e, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x80, 0x06, 0x0a, 0x16, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xc0, 0x05, 0x0a, 0x16, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x61, 0x73, 0x73, 0x70, 0x68, 0x72, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x61, 0x73, 0x73, 0x70, 0x68, 0x72, 0x61, 0x73, 0x65, 0x12, @@ -15890,39 +15858,35 @@ var file_api_proto_rawDesc = []byte{ 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6e, - 0x75, 0x6d, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x6f, 0x6f, - 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, 0x09, - 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x66, 0x65, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x08, 0x70, 0x6f, 0x6f, 0x6c, 0x46, 0x65, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x70, - 0x69, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, - 0x79, 0x12, 0x15, 0x0a, 0x06, 0x74, 0x78, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x75, 0x6d, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x70, + 0x69, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, + 0x79, 0x12, 0x15, 0x0a, 0x06, 0x74, 0x78, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x78, 0x46, 0x65, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x69, 0x63, 0x6b, - 0x65, 0x74, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, + 0x65, 0x74, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x46, 0x65, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x64, 0x6f, 0x6e, 0x74, 0x5f, - 0x73, 0x69, 0x67, 0x6e, 0x5f, 0x74, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, + 0x73, 0x69, 0x67, 0x6e, 0x5f, 0x74, 0x78, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x6f, 0x6e, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x54, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x73, 0x70, - 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x73, 0x70, 0x70, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x69, - 0x78, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, + 0x78, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x14, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, 0x6d, + 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x2e, 0x0a, 0x13, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, - 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, + 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x67, + 0x75, 0x6e, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x76, 0x73, 0x70, 0x5f, - 0x68, 0x6f, 0x73, 0x74, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x73, 0x70, 0x48, + 0x68, 0x6f, 0x73, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x73, 0x70, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x76, 0x73, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x6b, 0x65, - 0x79, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, 0x73, 0x70, 0x50, 0x75, 0x62, 0x6b, + 0x79, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, 0x73, 0x70, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x12, 0x75, 0x73, 0x65, 0x5f, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, - 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, + 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x75, 0x73, 0x65, 0x56, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, + 0x6e, 0x74, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x73, 0x0a, 0x17, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, @@ -16273,7 +16237,7 @@ var file_api_proto_rawDesc = []byte{ 0x12, 0x44, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x5f, 0x73, 0x65, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x64, 0x65, 0x63, 0x6f, 0x64, - 0x65, 0x64, 0x53, 0x65, 0x65, 0x64, 0x22, 0xae, 0x04, 0x0a, 0x15, 0x52, 0x75, 0x6e, 0x54, 0x69, + 0x65, 0x64, 0x53, 0x65, 0x65, 0x64, 0x22, 0xee, 0x03, 0x0a, 0x15, 0x52, 0x75, 0x6e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x75, 0x79, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x61, 0x73, 0x73, 0x70, 0x68, 0x72, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x61, 0x73, 0x73, 0x70, 0x68, 0x72, 0x61, 0x73, 0x65, @@ -16286,28 +16250,24 @@ var file_api_proto_rawDesc = []byte{ 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x6f, 0x4d, 0x61, 0x69, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x76, 0x6f, 0x74, 0x69, 0x6e, - 0x67, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x6f, 0x6f, 0x6c, - 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x70, 0x6f, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x70, - 0x6f, 0x6f, 0x6c, 0x5f, 0x66, 0x65, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, - 0x70, 0x6f, 0x6f, 0x6c, 0x46, 0x65, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x76, 0x73, 0x70, 0x5f, - 0x68, 0x6f, 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x73, 0x70, 0x48, + 0x67, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x76, 0x73, 0x70, 0x5f, + 0x68, 0x6f, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x73, 0x70, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x76, 0x73, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x6b, 0x65, - 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, 0x73, 0x70, 0x50, 0x75, 0x62, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, 0x73, 0x70, 0x50, 0x75, 0x62, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x73, 0x70, 0x70, - 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, + 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x73, 0x70, 0x70, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x69, 0x78, - 0x65, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, + 0x65, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x14, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, - 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, 0x6d, 0x69, + 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x2e, 0x0a, 0x13, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, - 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, 0x6d, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x6e, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x18, 0x0a, 0x16, 0x52, 0x75, 0x6e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x75, 0x79, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xd7, 0x01, 0x0a, 0x16, 0x52, 0x75, 0x6e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, diff --git a/ticketbuyer/tb.go b/ticketbuyer/tb.go index 20d572536..8fb06b8f4 100644 --- a/ticketbuyer/tb.go +++ b/ticketbuyer/tb.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2023 The Decred developers +// Copyright (c) 2018-2024 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -35,12 +35,6 @@ type Config struct { // Address to assign voting rights; overrides VotingAccount VotingAddr stdaddr.StakeAddress - // Commitment address for stakepool fees - PoolFeeAddr stdaddr.StakeAddress - - // Stakepool fee percentage (between 0-100) - PoolFees float64 - // Limit maximum number of purchased tickets per block Limit int @@ -241,8 +235,6 @@ func (tb *TB) buy(ctx context.Context, passphrase []byte, tip *wire.BlockHeader, account := cfg.Account maintain := cfg.Maintain votingAddr := cfg.VotingAddr - poolFeeAddr := cfg.PoolFeeAddr - poolFees := cfg.PoolFees limit := cfg.Limit mixing := cfg.Mixing votingAccount := cfg.VotingAccount @@ -306,10 +298,6 @@ func (tb *TB) buy(ctx context.Context, passphrase []byte, tip *wire.BlockHeader, MixedAccountBranch: mixedBranch, MixedSplitAccount: splitAccount, ChangeAccount: changeAccount, - - // VSPs - VSPAddress: poolFeeAddr, - VSPFees: poolFees, } // If VSP is configured, we need to set the methods for vsp fee processment. if tb.cfg.VSP != nil { diff --git a/wallet/createtx.go b/wallet/createtx.go index e230713db..d36a4b0cd 100644 --- a/wallet/createtx.go +++ b/wallet/createtx.go @@ -910,19 +910,12 @@ func (w *Wallet) compressWalletInternal(ctx context.Context, op errors.Op, dbtx return &txHash, nil } -// makeTicket creates a ticket from a split transaction output. It can optionally -// create a ticket that pays a fee to a pool if a pool input and pool address are -// passed. -func makeTicket(params *chaincfg.Params, inputPool *Input, input *Input, addrVote stdaddr.StakeAddress, - addrSubsidy stdaddr.StakeAddress, ticketCost int64, addrPool stdaddr.StakeAddress) (*wire.MsgTx, error) { +// makeTicket creates a ticket from a split transaction output. +func makeTicket(params *chaincfg.Params, input *Input, addrVote stdaddr.StakeAddress, + addrSubsidy stdaddr.StakeAddress, ticketCost int64) (*wire.MsgTx, error) { mtx := wire.NewMsgTx() - if addrPool != nil && inputPool != nil { - txIn := wire.NewTxIn(&inputPool.OutPoint, inputPool.PrevOut.Value, []byte{}) - mtx.AddTxIn(txIn) - } - txIn := wire.NewTxIn(&input.OutPoint, input.PrevOut.Value, []byte{}) mtx.AddTxIn(txIn) @@ -942,22 +935,12 @@ func makeTicket(params *chaincfg.Params, inputPool *Input, input *Input, addrVot // Obtain the commitment amounts. var amountsCommitted []int64 - userSubsidyNullIdx := 0 + const userSubsidyNullIdx = 0 var err error - if addrPool == nil { - _, amountsCommitted, err = stake.SStxNullOutputAmounts( - []int64{input.PrevOut.Value}, []int64{0}, ticketCost) - if err != nil { - return nil, err - } - - } else { - _, amountsCommitted, err = stake.SStxNullOutputAmounts( - []int64{inputPool.PrevOut.Value, input.PrevOut.Value}, []int64{0, 0}, ticketCost) - if err != nil { - return nil, err - } - userSubsidyNullIdx = 1 + _, amountsCommitted, err = stake.SStxNullOutputAmounts( + []int64{input.PrevOut.Value}, []int64{0}, ticketCost) + if err != nil { + return nil, err } // Zero value P2PKH addr. @@ -967,31 +950,7 @@ func makeTicket(params *chaincfg.Params, inputPool *Input, input *Input, addrVot return nil, err } - // 2. (Optional) If we're passed a pool address, make an extra - // commitment to the pool. - if addrPool != nil { - vers, pkScript := addrPool.RewardCommitmentScript( - amountsCommitted[0], 0, revocationFeeLimit) - txout := &wire.TxOut{ - Value: 0, - PkScript: pkScript, - Version: vers, - } - mtx.AddTxOut(txout) - - // Create a new script which pays to the provided address with an - // SStx change tagged output. - vers, pkScript = addrZeroed.StakeChangeScript() - - txOut = &wire.TxOut{ - Value: 0, - PkScript: pkScript, - Version: vers, - } - mtx.AddTxOut(txOut) - } - - // 3. Create the commitment and change output paying to the user. + // 2. Create the commitment and change output paying to the user. // // Create an OP_RETURN push containing the pubkeyhash to send rewards to. // Apply limits to revocations for fees while not allowing @@ -1184,69 +1143,6 @@ func (w *Wallet) individualSplit(ctx context.Context, req *PurchaseTicketsReques return } -func (w *Wallet) vspSplit(ctx context.Context, req *PurchaseTicketsRequest, neededPerTicket, vspFee dcrutil.Amount) (tx *wire.MsgTx, outIndexes []int, err error) { - // Fetch the single use split address to break tickets into, to - // immediately be consumed as tickets. - // - // This opens a write transaction. - splitTxAddr, err := w.NewInternalAddress(ctx, req.SourceAccount, WithGapPolicyWrap()) - if err != nil { - return - } - - vers, splitPkScript := splitTxAddr.PaymentScript() - - // Create the split transaction by using authorTx. This varies - // based upon whether or not the user is using a stake pool or not. - // For the default stake pool implementation, the user pays out the - // first ticket commitment of a smaller amount to the pool, while - // paying themselves with the larger ticket commitment. - var splitOuts []*wire.TxOut - for i := 0; i < req.Count; i++ { - userAmt := neededPerTicket - vspFee - splitOuts = append(splitOuts, &wire.TxOut{ - Value: int64(vspFee), - PkScript: splitPkScript, - Version: vers, - }) - splitOuts = append(splitOuts, &wire.TxOut{ - Value: int64(userAmt), - PkScript: splitPkScript, - Version: vers, - }) - outIndexes = append(outIndexes, i*2) - } - - const op errors.Op = "vspSplit" - a := &authorTx{ - outputs: splitOuts, - account: req.SourceAccount, - changeAccount: req.ChangeAccount, - minconf: req.MinConf, - randomizeChangeIdx: false, - txFee: w.RelayFee(), - dontSignTx: req.DontSignTx, - isTreasury: false, - } - err = w.authorTx(ctx, op, a) - if err != nil { - return - } - if !req.DontSignTx { - err = w.recordAuthoredTx(ctx, op, a) - if err != nil { - return - } - err = w.publishAndWatch(ctx, op, nil, a.atx.Tx, a.watch) - if err != nil { - return - } - } - - tx = a.atx.Tx - return -} - var errVSPFeeRequiresUTXOSplit = errors.New("paying VSP fee requires UTXO split") // purchaseTickets indicates to the wallet that a ticket should be purchased @@ -1310,21 +1206,6 @@ func (w *Wallet) purchaseTickets(ctx context.Context, op errors.Op, return nil, err } - // Try to get the pool address from the request. If none exists - // in the request, try to get the global pool address. Then do - // the same for pool fees, but check sanity too. - poolAddress := req.VSPAddress - if poolAddress == nil { - poolAddress = w.poolAddress - } - poolFees := req.VSPFees - if poolFees == 0.0 { - poolFees = w.poolFees - } - if poolAddress != nil && poolFees == 0.0 { - return nil, errors.E(op, errors.Invalid, "stakepool fee percent unset") - } - var stakeSubmissionPkScriptSize int // The stake submission pkScript is tagged by an OP_SSTX. @@ -1346,52 +1227,23 @@ func (w *Wallet) purchaseTickets(ctx context.Context, op errors.Op, var estSize int ticketRelayFee := w.RelayFee() - if poolAddress == nil { - // A solo ticket has: - // - a single input redeeming a P2PKH for the worst case size - // - a P2PKH or P2SH stake submission output - // - a ticket commitment output - // - an OP_SSTXCHANGE tagged P2PKH or P2SH change output - // - // NB: The wallet currently only supports P2PKH change addresses. - // The network supports both P2PKH and P2SH change addresses however. - inSizes := []int{txsizes.RedeemP2PKHSigScriptSize} - outSizes := []int{stakeSubmissionPkScriptSize, - txsizes.TicketCommitmentScriptSize, txsizes.P2PKHPkScriptSize + 1} - estSize = txsizes.EstimateSerializeSizeFromScriptSizes(inSizes, - outSizes, 0) - } else { - // A pool ticket has: - // - two inputs redeeming a P2PKH for the worst case size - // - a P2PKH or P2SH stake submission output - // - two ticket commitment outputs - // - two OP_SSTXCHANGE tagged P2PKH or P2SH change outputs - // - // NB: The wallet currently only supports P2PKH change addresses. - // The network supports both P2PKH and P2SH change addresses however. - inSizes := []int{txsizes.RedeemP2PKHSigScriptSize, - txsizes.RedeemP2PKHSigScriptSize} - outSizes := []int{stakeSubmissionPkScriptSize, - txsizes.TicketCommitmentScriptSize, txsizes.TicketCommitmentScriptSize, - txsizes.P2PKHPkScriptSize + 1, txsizes.P2PKHPkScriptSize + 1} - estSize = txsizes.EstimateSerializeSizeFromScriptSizes(inSizes, - outSizes, 0) - } + // A solo ticket has: + // - a single input redeeming a P2PKH for the worst case size + // - a P2PKH or P2SH stake submission output + // - a ticket commitment output + // - an OP_SSTXCHANGE tagged P2PKH or P2SH change output + // + // NB: The wallet currently only supports P2PKH change addresses. + // The network supports both P2PKH and P2SH change addresses however. + inSizes := []int{txsizes.RedeemP2PKHSigScriptSize} + outSizes := []int{stakeSubmissionPkScriptSize, + txsizes.TicketCommitmentScriptSize, txsizes.P2PKHPkScriptSize + 1} + estSize = txsizes.EstimateSerializeSizeFromScriptSizes(inSizes, + outSizes, 0) ticketFee := txrules.FeeForSerializeSize(ticketRelayFee, estSize) neededPerTicket = ticketFee + ticketPrice - // If we need to calculate the amount for a pool fee percentage, - // do so now. - var vspFee dcrutil.Amount - if poolAddress != nil { - // poolAddress is only used with the legacy stakepool - const dcp0010Active = false - const dcp0012Active = false - vspFee = txrules.StakePoolTicketFee(ticketPrice, ticketFee, - tipHeight, poolFees, w.ChainParams(), dcp0010Active, dcp0012Active) - } - // After tickets are created and published, watch for future // relevant transactions var watchOutPoints []wire.OutPoint @@ -1590,8 +1442,6 @@ func (w *Wallet) purchaseTickets(ctx context.Context, op errors.Op, switch { case req.Mixing: splitTx, splitOutputIndexes, err = w.mixedSplit(ctx, req, neededPerTicket) - case req.VSPAddress != nil: - splitTx, splitOutputIndexes, err = w.vspSplit(ctx, req, neededPerTicket, vspFee) default: splitTx, splitOutputIndexes, err = w.individualSplit(ctx, req, neededPerTicket) } @@ -1660,35 +1510,15 @@ func (w *Wallet) purchaseTickets(ctx context.Context, op errors.Op, tickets := make([]*wire.MsgTx, 0, req.Count) outpoint := wire.OutPoint{Hash: splitTx.TxHash()} for _, index := range splitOutputIndexes { - // Generate the extended outpoints that we need to use for ticket - // inputs. There are two inputs for pool tickets corresponding to the - // fees and the user subsidy, while user-handled tickets have only one + // Generate the extended outpoint that we need to use for ticket // input. - var eopPool, eop *Input - if poolAddress == nil { - op := outpoint - op.Index = uint32(index) - log.Infof("Split output is %v", &op) - txOut := splitTx.TxOut[index] - eop = &Input{ - OutPoint: op, - PrevOut: *txOut, - } - } else { - vspOutPoint := outpoint - vspOutPoint.Index = uint32(index) - vspOutput := splitTx.TxOut[vspOutPoint.Index] - eopPool = &Input{ - OutPoint: vspOutPoint, - PrevOut: *vspOutput, - } - myOutPoint := outpoint - myOutPoint.Index = uint32(index + 1) - myOutput := splitTx.TxOut[myOutPoint.Index] - eop = &Input{ - OutPoint: myOutPoint, - PrevOut: *myOutput, - } + var eop *Input + outpoint.Index = uint32(index) + log.Infof("Split output is %v", &outpoint) + txOut := splitTx.TxOut[index] + eop = &Input{ + OutPoint: outpoint, + PrevOut: *txOut, } // If the user hasn't specified a voting address @@ -1742,8 +1572,8 @@ func (w *Wallet) purchaseTickets(ctx context.Context, op errors.Op, w.lockedOutpointMu.Lock() err = walletdb.Update(ctx, w.db, func(dbtx walletdb.ReadWriteTx) error { // Generate the ticket msgTx and sign it if DontSignTx is false. - ticket, err := makeTicket(w.chainParams, eopPool, eop, addrVote, - addrSubsidy, int64(ticketPrice), poolAddress) + ticket, err := makeTicket(w.chainParams, eop, addrVote, + addrSubsidy, int64(ticketPrice)) if err != nil { return err } @@ -1761,11 +1591,7 @@ func (w *Wallet) purchaseTickets(ctx context.Context, op errors.Op, return nil } // Sign and publish tx if DontSignTx is false - var forSigning []Input - if eopPool != nil { - forSigning = append(forSigning, *eopPool) - } - forSigning = append(forSigning, *eop) + forSigning := []Input{*eop} ns := dbtx.ReadBucket(waddrmgrNamespaceKey) err = w.signP2PKHMsgTx(ticket, forSigning, ns) diff --git a/wallet/wallet.go b/wallet/wallet.go index 210a6ce10..6bcca0614 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -112,8 +112,6 @@ type Wallet struct { stakeSettingsLock sync.Mutex defaultVoteBits stake.VoteBits votingEnabled bool - poolAddress stdaddr.StakeAddress - poolFees float64 manualTickets bool subsidyCache *blockchain.SubsidyCache tspends map[chainhash.Hash]wire.MsgTx @@ -183,8 +181,6 @@ type Config struct { VotingEnabled bool VotingAddress stdaddr.StakeAddress - PoolAddress stdaddr.StakeAddress - PoolFees float64 GapLimit uint32 WatchLast uint32 @@ -1563,10 +1559,6 @@ type PurchaseTicketsRequest struct { MixedSplitAccount uint32 ChangeAccount uint32 - // VSP ticket buying; not currently usable with CoinShuffle++. - VSPAddress stdaddr.StakeAddress - VSPFees float64 - // VSPServer methods // XXX this should be an interface @@ -5392,8 +5384,6 @@ func Open(ctx context.Context, cfg *Config) (*Wallet, error) { // StakeOptions votingEnabled: cfg.VotingEnabled, ticketAddress: cfg.VotingAddress, - poolAddress: cfg.PoolAddress, - poolFees: cfg.PoolFees, tspends: make(map[chainhash.Hash]wire.MsgTx), tspendPolicy: make(map[chainhash.Hash]stake.TreasuryVoteT), tspendKeyPolicy: make(map[string]stake.TreasuryVoteT),