From c35ac6d9bb1df107e09ee5acf25ef50a96bea8cd Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Thu, 12 Jul 2018 00:16:29 +0800 Subject: [PATCH] Deprecate blockchain.block.get_header as of protocol 1.3 Use new blockchain.block.header instead. --- docs/protocol-changes.rst | 14 +++++ docs/protocol-methods.rst | 93 +++++++++++++++++++++------------- electrumx/server/controller.py | 2 +- electrumx/server/session.py | 13 +++++ 4 files changed, 87 insertions(+), 35 deletions(-) diff --git a/docs/protocol-changes.rst b/docs/protocol-changes.rst index f9cbbbd..fc203e8 100644 --- a/docs/protocol-changes.rst +++ b/docs/protocol-changes.rst @@ -82,3 +82,17 @@ Deprecated methods * :func:`blockchain.address.subscribe`. Switch to :func:`blockchain.scripthash.subscribe`. * :func:`blockchain.headers.subscribe` with *raw* other than :const:`True`. + +Version 1.3 +=========== + +New methods +----------- + + * :func:`blockchain.block.header` + +Deprecated methods +------------------ + + * :func:`blockchain.block.get_header`. Switch to + :func:`blockchain.block.header`. diff --git a/docs/protocol-methods.rst b/docs/protocol-methods.rst index 252d850..e569a6f 100644 --- a/docs/protocol-methods.rst +++ b/docs/protocol-methods.rst @@ -1,8 +1,9 @@ -Protocol Methods -================ +================== + Protocol Methods +================== blockchain.address.get_balance ------------------------------- +============================== Return the confirmed and unconfirmed balances of a bitcoin address. @@ -20,7 +21,7 @@ Return the confirmed and unconfirmed balances of a bitcoin address. See :func:`blockchain.scripthash.get_balance`. blockchain.address.get_history ------------------------------- +============================== Return the confirmed and unconfirmed history of a bitcoin address. @@ -38,7 +39,7 @@ Return the confirmed and unconfirmed history of a bitcoin address. As for :func:`blockchain.scripthash.get_history`. blockchain.address.get_mempool ------------------------------- +============================== Return the unconfirmed transactions of a bitcoin address. @@ -56,7 +57,7 @@ Return the unconfirmed transactions of a bitcoin address. As for :func:`blockchain.scripthash.get_mempool`. blockchain.address.listunspent ------------------------------- +============================== Return an ordered list of UTXOs sent to a bitcoin address. @@ -74,7 +75,7 @@ Return an ordered list of UTXOs sent to a bitcoin address. As for :func:`blockchain.scripthash.listunspent`. blockchain.address.subscribe ----------------------------- +============================ Subscribe to a bitcoin address. @@ -100,7 +101,7 @@ Subscribe to a bitcoin address. .. function:: blockchain.address.subscribe(address, status) blockchain.block.get_header ---------------------------- +=========================== Return the :ref:`deserialized header ` of the block at the given height. @@ -108,6 +109,7 @@ block at the given height. **Signature** .. function:: blockchain.block.get_header(height) + .. deprecated:: 1.3 *height* @@ -132,7 +134,7 @@ block at the given height. } blockchain.block.get_chunk --------------------------- +========================== Return a concatenated chunk of block headers from the main chain. Typically, a chunk consists of a fixed number of block headers over @@ -161,8 +163,31 @@ bandwidth-intensive request. implied starting height will be returned; this may range from zero to the coin-specific chunk size. +blockchain.block.header +======================= + +Return the block header at the given height. + +**Signature** + + .. function:: blockchain.block.header(height) + + *height* + + The height of the block, an integer. + +**Result** + + The raw block header as a hexadecimal string. + +**Example Result** + +:: + + "0100000085144a84488ea88d221c8bd6c059da090e88f8a2c99690ee55dbba4e00000000e11c48fecdd9e72510ca84f023370c9a38bf91ac5cae88019bee94d24528526344c36649ffff001d1d03e477" + blockchain.block.headers ------------------------- +======================== Return a concatenated chunk of block headers from the main chain. @@ -211,7 +236,7 @@ Return a concatenated chunk of block headers from the main chain. } blockchain.estimatefee ----------------------- +====================== Return the estimated transaction fee per kilobyte for a transaction to be confirmed within a certain number of blocks. @@ -237,7 +262,7 @@ be confirmed within a certain number of blocks. 0.00101079 blockchain.headers.subscribe ----------------------------- +============================ Subscribe to receive block headers when a new block is found. @@ -313,7 +338,7 @@ Subscribe to receive block headers when a new block is found. blockchain.numblocks.subscribe ------------------------------- +============================== Subscribe to receive the block height when a new block is found. @@ -335,7 +360,7 @@ Subscribe to receive the block height when a new block is found. .. function:: blockchain.numblocks.subscribe(height) blockchain.relayfee -------------------- +=================== Return the minimum fee a low-priority transaction must pay in order to be accepted to the daemon's memory pool. @@ -360,7 +385,7 @@ be accepted to the daemon's memory pool. 0.0 blockchain.scripthash.get_balance ---------------------------------- +================================= Return the confirmed and unconfirmed balances of a :ref:`script hash