From 8d1005706baa180ad78454f85066c2aff6bb8ef5 Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Thu, 14 Jul 2022 10:45:00 -0700 Subject: [PATCH] rpc: remove deprecated and unimplemented 'setaccount' --- btcjson/walletsvrcmds.go | 16 ---------------- btcjson/walletsvrcmds_test.go | 14 -------------- rpcclient/wallet.go | 27 --------------------------- rpcserver.go | 1 - 4 files changed, 58 deletions(-) diff --git a/btcjson/walletsvrcmds.go b/btcjson/walletsvrcmds.go index 8569c1d5..1c4da304 100644 --- a/btcjson/walletsvrcmds.go +++ b/btcjson/walletsvrcmds.go @@ -650,21 +650,6 @@ func NewSendToAddressCmd(address string, amount float64, comment, commentTo *str } } -// SetAccountCmd defines the setaccount JSON-RPC command. -type SetAccountCmd struct { - Address string - Account string -} - -// NewSetAccountCmd returns a new instance which can be used to issue a -// setaccount JSON-RPC command. -func NewSetAccountCmd(address, account string) *SetAccountCmd { - return &SetAccountCmd{ - Address: address, - Account: account, - } -} - // SetTxFeeCmd defines the settxfee JSON-RPC command. type SetTxFeeCmd struct { Amount float64 // In BTC @@ -1123,7 +1108,6 @@ func init() { MustRegisterCmd("sendfrom", (*SendFromCmd)(nil), flags) MustRegisterCmd("sendmany", (*SendManyCmd)(nil), flags) MustRegisterCmd("sendtoaddress", (*SendToAddressCmd)(nil), flags) - MustRegisterCmd("setaccount", (*SetAccountCmd)(nil), flags) MustRegisterCmd("settxfee", (*SetTxFeeCmd)(nil), flags) MustRegisterCmd("signmessage", (*SignMessageCmd)(nil), flags) MustRegisterCmd("signrawtransaction", (*SignRawTransactionCmd)(nil), flags) diff --git a/btcjson/walletsvrcmds_test.go b/btcjson/walletsvrcmds_test.go index d33888d4..d2cf1956 100644 --- a/btcjson/walletsvrcmds_test.go +++ b/btcjson/walletsvrcmds_test.go @@ -1205,20 +1205,6 @@ func TestWalletSvrCmds(t *testing.T) { CommentTo: btcjson.String("commentto"), }, }, - { - name: "setaccount", - newCmd: func() (interface{}, error) { - return btcjson.NewCmd("setaccount", "1Address", "acct") - }, - staticCmd: func() interface{} { - return btcjson.NewSetAccountCmd("1Address", "acct") - }, - marshalled: `{"jsonrpc":"1.0","method":"setaccount","params":["1Address","acct"],"id":1}`, - unmarshalled: &btcjson.SetAccountCmd{ - Address: "1Address", - Account: "acct", - }, - }, { name: "settxfee", newCmd: func() (interface{}, error) { diff --git a/rpcclient/wallet.go b/rpcclient/wallet.go index 784f0688..acccca9a 100644 --- a/rpcclient/wallet.go +++ b/rpcclient/wallet.go @@ -1279,33 +1279,6 @@ func (c *Client) GetAccount(address btcutil.Address) (string, error) { return c.GetAccountAsync(address).Receive() } -// FutureSetAccountResult is a future promise to deliver the result of a -// SetAccountAsync RPC invocation (or an applicable error). -type FutureSetAccountResult chan *Response - -// Receive waits for the Response promised by the future and returns the result -// of setting the account to be associated with the passed address. -func (r FutureSetAccountResult) Receive() error { - _, err := ReceiveFuture(r) - return err -} - -// SetAccountAsync returns an instance of a type that can be used to get the -// result of the RPC at some future time by invoking the Receive function on the -// returned instance. -// -// See SetAccount for the blocking version and more details. -func (c *Client) SetAccountAsync(address btcutil.Address, account string) FutureSetAccountResult { - addr := address.EncodeAddress() - cmd := btcjson.NewSetAccountCmd(addr, account) - return c.SendCmd(cmd) -} - -// SetAccount sets the account associated with the passed address. -func (c *Client) SetAccount(address btcutil.Address, account string) error { - return c.SetAccountAsync(address, account).Receive() -} - // FutureGetAddressesByAccountResult is a future promise to deliver the result // of a GetAddressesByAccountAsync RPC invocation (or an applicable error). type FutureGetAddressesByAccountResult struct { diff --git a/rpcserver.go b/rpcserver.go index fddfaaa3..a47ccbec 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -229,7 +229,6 @@ var rpcAskWallet = map[string]struct{}{ "sendfrom": {}, "sendmany": {}, "sendtoaddress": {}, - "setaccount": {}, "settxfee": {}, "signmessage": {}, "signrawtransaction": {},