From fae4063046884b5172f07d86035b06641da12a47 Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Thu, 14 Jul 2022 10:51:42 -0700 Subject: [PATCH] rpc: remove deprecated and unimplemented 'move' --- btcjson/walletsvrcmds.go | 25 ------------- btcjson/walletsvrcmds_test.go | 51 -------------------------- rpcclient/wallet.go | 68 ----------------------------------- rpcserver.go | 1 - 4 files changed, 145 deletions(-) diff --git a/btcjson/walletsvrcmds.go b/btcjson/walletsvrcmds.go index 1c4da304..f43e3c22 100644 --- a/btcjson/walletsvrcmds.go +++ b/btcjson/walletsvrcmds.go @@ -556,30 +556,6 @@ func NewLockUnspentCmd(unlock bool, transactions []TransactionInput) *LockUnspen } } -// MoveCmd defines the move JSON-RPC command. -type MoveCmd struct { - FromAccount string - ToAccount string - Amount float64 // In BTC - MinConf *int `jsonrpcdefault:"1"` - Comment *string -} - -// NewMoveCmd returns a new instance which can be used to issue a move JSON-RPC -// command. -// -// The parameters which are pointers indicate they are optional. Passing nil -// for optional parameters will use the default value. -func NewMoveCmd(fromAccount, toAccount string, amount float64, minConf *int, comment *string) *MoveCmd { - return &MoveCmd{ - FromAccount: fromAccount, - ToAccount: toAccount, - Amount: amount, - MinConf: minConf, - Comment: comment, - } -} - // SendFromCmd defines the sendfrom JSON-RPC command. type SendFromCmd struct { FromAccount string @@ -1104,7 +1080,6 @@ func init() { MustRegisterCmd("listunspent", (*ListUnspentCmd)(nil), flags) MustRegisterCmd("loadwallet", (*LoadWalletCmd)(nil), flags) MustRegisterCmd("lockunspent", (*LockUnspentCmd)(nil), flags) - MustRegisterCmd("move", (*MoveCmd)(nil), flags) MustRegisterCmd("sendfrom", (*SendFromCmd)(nil), flags) MustRegisterCmd("sendmany", (*SendManyCmd)(nil), flags) MustRegisterCmd("sendtoaddress", (*SendToAddressCmd)(nil), flags) diff --git a/btcjson/walletsvrcmds_test.go b/btcjson/walletsvrcmds_test.go index d2cf1956..e19adf6c 100644 --- a/btcjson/walletsvrcmds_test.go +++ b/btcjson/walletsvrcmds_test.go @@ -996,57 +996,6 @@ func TestWalletSvrCmds(t *testing.T) { }, }, }, - { - name: "move", - newCmd: func() (interface{}, error) { - return btcjson.NewCmd("move", "from", "to", 0.5) - }, - staticCmd: func() interface{} { - return btcjson.NewMoveCmd("from", "to", 0.5, nil, nil) - }, - marshalled: `{"jsonrpc":"1.0","method":"move","params":["from","to",0.5],"id":1}`, - unmarshalled: &btcjson.MoveCmd{ - FromAccount: "from", - ToAccount: "to", - Amount: 0.5, - MinConf: btcjson.Int(1), - Comment: nil, - }, - }, - { - name: "move optional1", - newCmd: func() (interface{}, error) { - return btcjson.NewCmd("move", "from", "to", 0.5, 6) - }, - staticCmd: func() interface{} { - return btcjson.NewMoveCmd("from", "to", 0.5, btcjson.Int(6), nil) - }, - marshalled: `{"jsonrpc":"1.0","method":"move","params":["from","to",0.5,6],"id":1}`, - unmarshalled: &btcjson.MoveCmd{ - FromAccount: "from", - ToAccount: "to", - Amount: 0.5, - MinConf: btcjson.Int(6), - Comment: nil, - }, - }, - { - name: "move optional2", - newCmd: func() (interface{}, error) { - return btcjson.NewCmd("move", "from", "to", 0.5, 6, "comment") - }, - staticCmd: func() interface{} { - return btcjson.NewMoveCmd("from", "to", 0.5, btcjson.Int(6), btcjson.String("comment")) - }, - marshalled: `{"jsonrpc":"1.0","method":"move","params":["from","to",0.5,6,"comment"],"id":1}`, - unmarshalled: &btcjson.MoveCmd{ - FromAccount: "from", - ToAccount: "to", - Amount: 0.5, - MinConf: btcjson.Int(6), - Comment: btcjson.String("comment"), - }, - }, { name: "sendfrom", newCmd: func() (interface{}, error) { diff --git a/rpcclient/wallet.go b/rpcclient/wallet.go index acccca9a..6f54730b 100644 --- a/rpcclient/wallet.go +++ b/rpcclient/wallet.go @@ -1355,74 +1355,6 @@ func (r FutureMoveResult) Receive() (bool, error) { return moveResult, nil } -// MoveAsync 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 Move for the blocking version and more details. -func (c *Client) MoveAsync(fromAccount, toAccount string, amount btcutil.Amount) FutureMoveResult { - cmd := btcjson.NewMoveCmd(fromAccount, toAccount, amount.ToBTC(), nil, - nil) - return c.SendCmd(cmd) -} - -// Move moves specified amount from one account in your wallet to another. Only -// funds with the default number of minimum confirmations will be used. -// -// See MoveMinConf and MoveComment for different options. -func (c *Client) Move(fromAccount, toAccount string, amount btcutil.Amount) (bool, error) { - return c.MoveAsync(fromAccount, toAccount, amount).Receive() -} - -// MoveMinConfAsync 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 MoveMinConf for the blocking version and more details. -func (c *Client) MoveMinConfAsync(fromAccount, toAccount string, - amount btcutil.Amount, minConfirms int) FutureMoveResult { - - cmd := btcjson.NewMoveCmd(fromAccount, toAccount, amount.ToBTC(), - &minConfirms, nil) - return c.SendCmd(cmd) -} - -// MoveMinConf moves specified amount from one account in your wallet to -// another. Only funds with the passed number of minimum confirmations will be -// used. -// -// See Move to use the default number of minimum confirmations and MoveComment -// for additional options. -func (c *Client) MoveMinConf(fromAccount, toAccount string, amount btcutil.Amount, minConf int) (bool, error) { - return c.MoveMinConfAsync(fromAccount, toAccount, amount, minConf).Receive() -} - -// MoveCommentAsync 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 MoveComment for the blocking version and more details. -func (c *Client) MoveCommentAsync(fromAccount, toAccount string, - amount btcutil.Amount, minConfirms int, comment string) FutureMoveResult { - - cmd := btcjson.NewMoveCmd(fromAccount, toAccount, amount.ToBTC(), - &minConfirms, &comment) - return c.SendCmd(cmd) -} - -// MoveComment moves specified amount from one account in your wallet to -// another and stores the provided comment in the wallet. The comment -// parameter is only available in the wallet. Only funds with the passed number -// of minimum confirmations will be used. -// -// See Move and MoveMinConf to use defaults. -func (c *Client) MoveComment(fromAccount, toAccount string, amount btcutil.Amount, - minConf int, comment string) (bool, error) { - - return c.MoveCommentAsync(fromAccount, toAccount, amount, minConf, - comment).Receive() -} - // FutureRenameAccountResult is a future promise to deliver the result of a // RenameAccountAsync RPC invocation (or an applicable error). type FutureRenameAccountResult chan *Response diff --git a/rpcserver.go b/rpcserver.go index a47ccbec..1e37f458 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -225,7 +225,6 @@ var rpcAskWallet = map[string]struct{}{ "listtransactions": {}, "listunspent": {}, "lockunspent": {}, - "move": {}, "sendfrom": {}, "sendmany": {}, "sendtoaddress": {},