From 471899ae2d11a152edf08534c64fdd5ba86310ca Mon Sep 17 00:00:00 2001 From: thephez Date: Mon, 30 Sep 2019 16:06:46 -0400 Subject: [PATCH] RPC - Add getbestchainlock (#160) * RPC - Add getbestchainlock * Add missing markdown file --- _autocrossref.yaml | 2 + _config.yml | 1 + .../devdoc/dash-core/rpcs/quick-reference.md | 1 + .../dash-core/rpcs/rpcs/getbestchainlock.md | 64 +++++++++++++++++++ _includes/helpers/summaries.md | 1 + _includes/layout/base/rpc-table.html | 6 ++ _includes/references.md | 1 + en/developer-reference.md | 2 + 8 files changed, 78 insertions(+) create mode 100644 _includes/devdoc/dash-core/rpcs/rpcs/getbestchainlock.md diff --git a/_autocrossref.yaml b/_autocrossref.yaml index 0ae94ca8..3c0e6b4d 100644 --- a/_autocrossref.yaml +++ b/_autocrossref.yaml @@ -357,6 +357,8 @@ DIP8: '`getbalance` RPC': rpc getbalance '`getbestblockhash`': rpc getbestblockhash '`getbestblockhash` RPC': rpc getbestblockhash +'`getbestchainlock`': rpc getbestchainlock +'`getbestchainlock` RPC': rpc getbestchainlock '`getblock`': rpc getblock '`getblock` RPC': rpc getblock '`getblockchaininfo`': rpc getblockchaininfo diff --git a/_config.yml b/_config.yml index d6a31249..f42d73b0 100644 --- a/_config.yml +++ b/_config.yml @@ -200,6 +200,7 @@ devsearches: - 'GetAddressUtxos': "/en/developer-reference#getaddressutxos" - 'GetBalance': "/en/developer-reference#getbalance" - 'GetBestBlockHash': "/en/developer-reference#getbestblockhash" + - 'GetBestChainLock': "/en/developer-reference#getbestchainlock" - 'GetBlock': "/en/developer-reference#getblock" - 'GetBlockChainInfo': "/en/developer-reference#getblockchaininfo" - 'GetBlockCount': "/en/developer-reference#getblockcount" diff --git a/_includes/devdoc/dash-core/rpcs/quick-reference.md b/_includes/devdoc/dash-core/rpcs/quick-reference.md index 02f9bfc3..2d1a0d13 100644 --- a/_includes/devdoc/dash-core/rpcs/quick-reference.md +++ b/_includes/devdoc/dash-core/rpcs/quick-reference.md @@ -117,6 +117,7 @@ These RPCs are all Dash-specific and not found in Bitcoin Core {% autocrossref %} * [GetBestBlockHash][rpc getbestblockhash]: {{summary_getBestBlockHash}} +* [GetBestChainLock][rpc getbestchainlock]: {{summary_getBestChainLock}} {{DASH_NEW0_14_1}} * [GetBlock][rpc getblock]: {{summary_getBlock}} {{DASH_UPDATED0_14_1}} * [GetBlockChainInfo][rpc getblockchaininfo]: {{summary_getBlockChainInfo}} {{DASH_UPDATED0_14_1}} * [GetBlockCount][rpc getblockcount]: {{summary_getBlockCount}} diff --git a/_includes/devdoc/dash-core/rpcs/rpcs/getbestchainlock.md b/_includes/devdoc/dash-core/rpcs/rpcs/getbestchainlock.md new file mode 100644 index 00000000..7065cf86 --- /dev/null +++ b/_includes/devdoc/dash-core/rpcs/rpcs/getbestchainlock.md @@ -0,0 +1,64 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_includes/devdoc/dash-core/rpcs/rpcs/getbestchainlock.md" %} + + + +##### GetBestChainLock +{% include helpers/subhead-links.md %} + +{% assign summary_getBestChainLock="returns the block hash of the best chainlock." %} + +{% autocrossref %} + +The `getbestchainlock` RPC {{summary_getBestChainLock}} + +Throws an error if there is no known chainlock yet. + +*Parameters: none* + +*Result* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "object/null" + p: "Required
(exactly 1)" + d: "An object containing the requested block, or JSON `null` if an error occurred" + +- n: "→
`blockhash`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "The hash of the block encoded as hex in RPC byte order." + +- n: "→
`height`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The height of this block on its block chain" + +- n: "→
`known_block`" + t: "boolean" + p: "Required
(exactly 1)" + d: "True if the block is known by this node" + +{% enditemplate %} + +*Example from Dash Core 0.14.1* + +{% highlight bash %} +dash-cli -testnet getbestchainlock +{% endhighlight %} + +Result: +{% highlight json %} +{ + "blockhash": "000000000036ab34d3005941d4224fc5887526355c98b769e27e5ece05f48860", + "height": 182106, + "known_block": true +} +{% endhighlight %} + +*See also: none* + +{% endautocrossref %} diff --git a/_includes/helpers/summaries.md b/_includes/helpers/summaries.md index d4b1fbd0..2d1204e7 100644 --- a/_includes/helpers/summaries.md +++ b/_includes/helpers/summaries.md @@ -36,6 +36,7 @@ This file is licensed under the terms of its source texts{%endcomment%} {% assign summary_getAddressesByAccount="returns a list of every address assigned to a particular account." %} {% assign summary_getBalance="gets the balance in decimal dash across all accounts or for a particular account." %} {% assign summary_getBestBlockHash="returns the header hash of the most recent block on the best block chain." %} +{% assign summary_getBestChainLock="returns the block hash of the best chainlock." %} {% assign summary_getBlock="gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block." %} {% assign summary_getBlockChainInfo="provides information about the current state of the block chain." %} {% assign summary_getBlockCount="returns the number of blocks in the local best block chain." %} diff --git a/_includes/layout/base/rpc-table.html b/_includes/layout/base/rpc-table.html index 36a9c00f..820fbd10 100644 --- a/_includes/layout/base/rpc-table.html +++ b/_includes/layout/base/rpc-table.html @@ -67,6 +67,12 @@ th.tg-sort-header::-moz-selection { background:transparent; }th.tg-sort-header:: Y + + Blockchain + GetBestChainLock + Y + Added in 0.14.1 + Blockchain GetBlock diff --git a/_includes/references.md b/_includes/references.md index dd155f6f..f6d62ef4 100644 --- a/_includes/references.md +++ b/_includes/references.md @@ -103,6 +103,7 @@ http://opensource.org/licenses/MIT. [rpc getaddressutxos]: /en/developer-reference#getaddressutxos [rpc getbalance]: /en/developer-reference#getbalance [rpc getbestblockhash]: /en/developer-reference#getbestblockhash +[rpc getbestchainlock]: /en/developer-reference#getbestchainlock [rpc getblock]: /en/developer-reference#getblock [rpc getblockchaininfo]: /en/developer-reference#getblockchaininfo [rpc getblockcount]: /en/developer-reference#getblockcount diff --git a/en/developer-reference.md b/en/developer-reference.md index 43fae5c0..85658c35 100644 --- a/en/developer-reference.md +++ b/en/developer-reference.md @@ -140,6 +140,8 @@ untrusted source. {% include devdoc/dash-core/rpcs/rpcs/getbestblockhash.md %} +{% include devdoc/dash-core/rpcs/rpcs/getbestchainlock.md %} + {% include devdoc/dash-core/rpcs/rpcs/getblock.md %} {% include devdoc/dash-core/rpcs/rpcs/getblockchaininfo.md %}