Update SearchRawTransaction calls for latest API.
This commit modifies the SearchRawTransactions and SearchRawTransactionsVerbose functions to work properly with the latest searchrawtransactions API in btcd. In particular, this involves adding a new parameter for the reverse option which specifies whether or not to include the results in reverse order.
This commit is contained in:
parent
d06c232f04
commit
29a2544887
1 changed files with 8 additions and 8 deletions
|
@ -549,11 +549,11 @@ func (r FutureSearchRawTransactionsResult) Receive() ([]*wire.MsgTx, error) {
|
||||||
// function on the returned instance.
|
// function on the returned instance.
|
||||||
//
|
//
|
||||||
// See SearchRawTransactions for the blocking version and more details.
|
// See SearchRawTransactions for the blocking version and more details.
|
||||||
func (c *Client) SearchRawTransactionsAsync(address btcutil.Address, skip, count int) FutureSearchRawTransactionsResult {
|
func (c *Client) SearchRawTransactionsAsync(address btcutil.Address, skip, count int, reverse bool) FutureSearchRawTransactionsResult {
|
||||||
addr := address.EncodeAddress()
|
addr := address.EncodeAddress()
|
||||||
verbose := btcjson.Int(0)
|
verbose := btcjson.Int(0)
|
||||||
cmd := btcjson.NewSearchRawTransactionsCmd(addr, verbose, &skip, &count,
|
cmd := btcjson.NewSearchRawTransactionsCmd(addr, verbose, &skip, &count,
|
||||||
nil)
|
nil, &reverse)
|
||||||
return c.sendCmd(cmd)
|
return c.sendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,8 +564,8 @@ func (c *Client) SearchRawTransactionsAsync(address btcutil.Address, skip, count
|
||||||
//
|
//
|
||||||
// See SearchRawTransactionsVerbose to retrieve a list of data structures with
|
// See SearchRawTransactionsVerbose to retrieve a list of data structures with
|
||||||
// information about the transactions instead of the transactions themselves.
|
// information about the transactions instead of the transactions themselves.
|
||||||
func (c *Client) SearchRawTransactions(address btcutil.Address, skip, count int) ([]*wire.MsgTx, error) {
|
func (c *Client) SearchRawTransactions(address btcutil.Address, skip, count int, reverse bool) ([]*wire.MsgTx, error) {
|
||||||
return c.SearchRawTransactionsAsync(address, skip, count).Receive()
|
return c.SearchRawTransactionsAsync(address, skip, count, reverse).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FutureSearchRawTransactionsVerboseResult is a future promise to deliver the
|
// FutureSearchRawTransactionsVerboseResult is a future promise to deliver the
|
||||||
|
@ -597,7 +597,7 @@ func (r FutureSearchRawTransactionsVerboseResult) Receive() ([]*btcjson.SearchRa
|
||||||
//
|
//
|
||||||
// See SearchRawTransactionsVerbose for the blocking version and more details.
|
// See SearchRawTransactionsVerbose for the blocking version and more details.
|
||||||
func (c *Client) SearchRawTransactionsVerboseAsync(address btcutil.Address, skip,
|
func (c *Client) SearchRawTransactionsVerboseAsync(address btcutil.Address, skip,
|
||||||
count int, includePrevOut bool) FutureSearchRawTransactionsVerboseResult {
|
count int, includePrevOut, reverse bool) FutureSearchRawTransactionsVerboseResult {
|
||||||
|
|
||||||
addr := address.EncodeAddress()
|
addr := address.EncodeAddress()
|
||||||
verbose := btcjson.Int(1)
|
verbose := btcjson.Int(1)
|
||||||
|
@ -606,7 +606,7 @@ func (c *Client) SearchRawTransactionsVerboseAsync(address btcutil.Address, skip
|
||||||
prevOut = btcjson.Int(1)
|
prevOut = btcjson.Int(1)
|
||||||
}
|
}
|
||||||
cmd := btcjson.NewSearchRawTransactionsCmd(addr, verbose, &skip, &count,
|
cmd := btcjson.NewSearchRawTransactionsCmd(addr, verbose, &skip, &count,
|
||||||
prevOut)
|
prevOut, &reverse)
|
||||||
return c.sendCmd(cmd)
|
return c.sendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,8 +618,8 @@ func (c *Client) SearchRawTransactionsVerboseAsync(address btcutil.Address, skip
|
||||||
//
|
//
|
||||||
// See SearchRawTransactions to retrieve a list of raw transactions instead.
|
// See SearchRawTransactions to retrieve a list of raw transactions instead.
|
||||||
func (c *Client) SearchRawTransactionsVerbose(address btcutil.Address, skip,
|
func (c *Client) SearchRawTransactionsVerbose(address btcutil.Address, skip,
|
||||||
count int, includePrevOut bool) ([]*btcjson.SearchRawTransactionsResult, error) {
|
count int, includePrevOut, reverse bool) ([]*btcjson.SearchRawTransactionsResult, error) {
|
||||||
|
|
||||||
return c.SearchRawTransactionsVerboseAsync(address, skip, count,
|
return c.SearchRawTransactionsVerboseAsync(address, skip, count,
|
||||||
includePrevOut).Receive()
|
includePrevOut, reverse).Receive()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue