diff --git a/btcjson/walletsvrcmds_test.go b/btcjson/walletsvrcmds_test.go index c45dfed1..2e1780c1 100644 --- a/btcjson/walletsvrcmds_test.go +++ b/btcjson/walletsvrcmds_test.go @@ -708,6 +708,21 @@ func TestWalletSvrCmds(t *testing.T) { IncludeWatchOnly: btcjson.Bool(true), }, }, + { + name: "listsinceblock pad null", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listsinceblock", "null", 1, false) + }, + staticCmd: func() interface{} { + return btcjson.NewListSinceBlockCmd(nil, btcjson.Int(1), btcjson.Bool(false)) + }, + marshalled: `{"jsonrpc":"1.0","method":"listsinceblock","params":[null,1,false],"id":1}`, + unmarshalled: &btcjson.ListSinceBlockCmd{ + BlockHash: nil, + TargetConfirmations: btcjson.Int(1), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, { name: "listtransactions", newCmd: func() (interface{}, error) { diff --git a/rpcclient/wallet.go b/rpcclient/wallet.go index 6b04ced7..c80f6ba7 100644 --- a/rpcclient/wallet.go +++ b/rpcclient/wallet.go @@ -326,6 +326,7 @@ func (c *Client) ListSinceBlockAsync(blockHash *chainhash.Hash) FutureListSinceB // minimum confirmations as a filter. // // See ListSinceBlockMinConf to override the minimum number of confirmations. +// See ListSinceBlockMinConfWatchOnly to override the minimum number of confirmations and watch only parameter. func (c *Client) ListSinceBlock(blockHash *chainhash.Hash) (*btcjson.ListSinceBlockResult, error) { return c.ListSinceBlockAsync(blockHash).Receive() } @@ -354,6 +355,30 @@ func (c *Client) ListSinceBlockMinConf(blockHash *chainhash.Hash, minConfirms in return c.ListSinceBlockMinConfAsync(blockHash, minConfirms).Receive() } +// ListSinceBlockMinConfWatchOnlyAsync 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 ListSinceBlockMinConfWatchOnly for the blocking version and more details. +func (c *Client) ListSinceBlockMinConfWatchOnlyAsync(blockHash *chainhash.Hash, minConfirms int, watchOnly bool) FutureListSinceBlockResult { + var hash *string + if blockHash != nil { + hash = btcjson.String(blockHash.String()) + } + + cmd := btcjson.NewListSinceBlockCmd(hash, &minConfirms, &watchOnly) + return c.sendCmd(cmd) +} + +// ListSinceBlockMinConfWatchOnly returns all transactions added in blocks since the +// specified block hash, or all transactions if it is nil, using the specified +// number of minimum confirmations as a filter. +// +// See ListSinceBlock to use the default minimum number of confirmations and default watch only paremeter. +func (c *Client) ListSinceBlockMinConfWatchOnly(blockHash *chainhash.Hash, minConfirms int, watchOnly bool) (*btcjson.ListSinceBlockResult, error) { + return c.ListSinceBlockMinConfWatchOnlyAsync(blockHash, minConfirms, watchOnly).Receive() +} + // ************************** // Transaction Send Functions // **************************