Skip to content

Commit

Permalink
Merge pull request #27 from beho/master
Browse files Browse the repository at this point in the history
getbestblockhash API call support
  • Loading branch information
sinisterchipmunk committed May 31, 2014
2 parents 9e8342f + f549579 commit 33a5ac8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/bitcoin-client/client.rb
Expand Up @@ -62,6 +62,10 @@ def getbalance(account = nil, minconf = 1)
@api.request 'getbalance', account, minconf
end

def getbestblockhash
@api.request 'getbestblockhash'
end

# Dumps the block existing at specified height.
# Note: this is not available in the official release
def getblockbycount(height)
Expand Down Expand Up @@ -298,6 +302,7 @@ def walletlock
alias account_address getaccountaddress
alias addresses_by_account getaddressesbyaccount
alias balance getbalance
alias bestblockhash getbestblockhash
alias block_by_count getblockbycount
alias block_count getblockcount
alias block_number getblocknumber
Expand Down
5 changes: 5 additions & 0 deletions lib/bitcoin-client/dsl.rb
Expand Up @@ -77,6 +77,11 @@ def getaddressesbyaccount(account)
def getbalance(account = nil, minconf = 1)
bitcoin.getbalance account, minconf
end

# Returns the hash of the best (tip) block in the longest block chain.
def getbestblockhash
bitcoin.getbestblockhash
end

# Dumps the block existing at specified height.
# Note: this is not available in the official release
Expand Down
8 changes: 8 additions & 0 deletions spec/fixtures/getbestblockhash.json
@@ -0,0 +1,8 @@
HTTP/1.1 200 OK
Date: Sat, 31 May 2014 17:57:47 +0000
Connection: keep-alive
Content-Length: 107
Content-Type: application/json
Server: bitcoin-json-rpc/v0.9.0.0-g92d25e4-beta

{"result":"00000000fca1180c1a3cb0c14a88a8feda089c62f57778beb241aaabcd512309","error":null,"id":"curltest"}

0 comments on commit 33a5ac8

Please sign in to comment.