Added ListSinceBlockMinConfWatchOnly method.

This commit is contained in:
Andrew Tugarinov 2020-09-08 23:15:49 +07:00 committed by John C. Vernaleo
parent 6f49f1f194
commit 5ae1f21cd9
2 changed files with 40 additions and 0 deletions

View file

@ -708,6 +708,21 @@ func TestWalletSvrCmds(t *testing.T) {
IncludeWatchOnly: btcjson.Bool(true), 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", name: "listtransactions",
newCmd: func() (interface{}, error) { newCmd: func() (interface{}, error) {

View file

@ -326,6 +326,7 @@ func (c *Client) ListSinceBlockAsync(blockHash *chainhash.Hash) FutureListSinceB
// minimum confirmations as a filter. // minimum confirmations as a filter.
// //
// See ListSinceBlockMinConf to override the minimum number of confirmations. // 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) { func (c *Client) ListSinceBlock(blockHash *chainhash.Hash) (*btcjson.ListSinceBlockResult, error) {
return c.ListSinceBlockAsync(blockHash).Receive() return c.ListSinceBlockAsync(blockHash).Receive()
} }
@ -354,6 +355,30 @@ func (c *Client) ListSinceBlockMinConf(blockHash *chainhash.Hash, minConfirms in
return c.ListSinceBlockMinConfAsync(blockHash, minConfirms).Receive() 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 // Transaction Send Functions
// ************************** // **************************