Fix GetBlockVerbose API.
This changes the GetBlockVersion API to not send a third parameter. The third parameter is a boolean that expands the transaction data structures as well. However, Bitcore Core does not recognize this feature. GetBlockVerbose now only takes a hash value. Users of the GetBlockVerbose(hash, true) must now use GetBlockVerboseTx(hash).
This commit is contained in:
parent
982229439a
commit
6e5c0a7904
1 changed files with 29 additions and 4 deletions
33
chain.go
33
chain.go
|
@ -134,22 +134,47 @@ func (r FutureGetBlockVerboseResult) Receive() (*btcjson.GetBlockVerboseResult,
|
||||||
// the returned instance.
|
// the returned instance.
|
||||||
//
|
//
|
||||||
// See GetBlockVerbose for the blocking version and more details.
|
// See GetBlockVerbose for the blocking version and more details.
|
||||||
func (c *Client) GetBlockVerboseAsync(blockHash *chainhash.Hash, verboseTx bool) FutureGetBlockVerboseResult {
|
func (c *Client) GetBlockVerboseAsync(blockHash *chainhash.Hash) FutureGetBlockVerboseResult {
|
||||||
hash := ""
|
hash := ""
|
||||||
if blockHash != nil {
|
if blockHash != nil {
|
||||||
hash = blockHash.String()
|
hash = blockHash.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := btcjson.NewGetBlockCmd(hash, btcjson.Bool(true), &verboseTx)
|
cmd := btcjson.NewGetBlockCmd(hash, btcjson.Bool(true), nil)
|
||||||
return c.sendCmd(cmd)
|
return c.sendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBlockVerbose returns a data structure from the server with information
|
// GetBlockVerbose returns a data structure from the server with information
|
||||||
// about a block given its hash.
|
// about a block given its hash.
|
||||||
//
|
//
|
||||||
|
// See GetBlockVerboseTx to retrieve transaction data structures as well.
|
||||||
// See GetBlock to retrieve a raw block instead.
|
// See GetBlock to retrieve a raw block instead.
|
||||||
func (c *Client) GetBlockVerbose(blockHash *chainhash.Hash, verboseTx bool) (*btcjson.GetBlockVerboseResult, error) {
|
func (c *Client) GetBlockVerbose(blockHash *chainhash.Hash) (*btcjson.GetBlockVerboseResult, error) {
|
||||||
return c.GetBlockVerboseAsync(blockHash, verboseTx).Receive()
|
return c.GetBlockVerboseAsync(blockHash).Receive()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetBlockVerboseTxAsync 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 GetBlockVerboseTx or the blocking version and more details.
|
||||||
|
func (c *Client) GetBlockVerboseTxAsync(blockHash *chainhash.Hash) FutureGetBlockVerboseResult {
|
||||||
|
hash := ""
|
||||||
|
if blockHash != nil {
|
||||||
|
hash = blockHash.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd := btcjson.NewGetBlockCmd(hash, btcjson.Bool(true), btcjson.Bool(true))
|
||||||
|
return c.sendCmd(cmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetBlockVerboseTx returns a data structure from the server with information
|
||||||
|
// about a block and its transactions given its hash.
|
||||||
|
//
|
||||||
|
// See GetBlockVerbose if only transaction hashes are preferred.
|
||||||
|
// See GetBlock to retrieve a raw block instead.
|
||||||
|
func (c *Client) GetBlockVerboseTx(blockHash *chainhash.Hash) (*btcjson.GetBlockVerboseResult, error) {
|
||||||
|
return c.GetBlockVerboseTxAsync(blockHash).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FutureGetBlockCountResult is a future promise to deliver the result of a
|
// FutureGetBlockCountResult is a future promise to deliver the result of a
|
||||||
|
|
Loading…
Add table
Reference in a new issue