Add hashFinalSaplingRoot to getblocktemplate
This commit is contained in:
parent
bae5adf0a4
commit
25c13ef702
|
@ -4,8 +4,8 @@
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import initialize_chain_clean, start_nodes, \
|
from test_framework.util import assert_equal, connect_nodes_bi, \
|
||||||
connect_nodes_bi
|
initialize_chain_clean, start_nodes
|
||||||
|
|
||||||
|
|
||||||
class GetBlockTemplateTest(BitcoinTestFramework):
|
class GetBlockTemplateTest(BitcoinTestFramework):
|
||||||
|
@ -49,11 +49,16 @@ class GetBlockTemplateTest(BitcoinTestFramework):
|
||||||
|
|
||||||
# Test 5: General checks
|
# Test 5: General checks
|
||||||
tmpl = node.getblocktemplate()
|
tmpl = node.getblocktemplate()
|
||||||
assert(len(tmpl['noncerange']) == 16)
|
assert_equal(16, len(tmpl['noncerange']))
|
||||||
|
|
||||||
# Test 6: coinbasetxn checks
|
# Test 6: coinbasetxn checks
|
||||||
assert('foundersreward' in tmpl['coinbasetxn'])
|
assert('foundersreward' in tmpl['coinbasetxn'])
|
||||||
assert(tmpl['coinbasetxn']['required'])
|
assert(tmpl['coinbasetxn']['required'])
|
||||||
|
|
||||||
|
# Test 7: hashFinalSaplingRoot checks
|
||||||
|
assert('finalsaplingroothash' in tmpl)
|
||||||
|
finalsaplingroothash = '3e49b5f954aa9d3545bc6c37744661eea48d7c34e3000d82b7f0010c30f4c2fb'
|
||||||
|
assert_equal(finalsaplingroothash, tmpl['finalsaplingroothash'])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
GetBlockTemplateTest().main()
|
GetBlockTemplateTest().main()
|
||||||
|
|
|
@ -447,9 +447,10 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
||||||
|
|
||||||
"\nResult:\n"
|
"\nResult:\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"version\" : n, (numeric) The block version\n"
|
" \"version\" : n, (numeric) The block version\n"
|
||||||
" \"previousblockhash\" : \"xxxx\", (string) The hash of current highest block\n"
|
" \"previousblockhash\" : \"xxxx\", (string) The hash of current highest block\n"
|
||||||
" \"transactions\" : [ (array) contents of non-coinbase transactions that should be included in the next block\n"
|
" \"finalsaplingroothash\" : \"xxxx\", (string) The hash of the final sapling root\n"
|
||||||
|
" \"transactions\" : [ (array) contents of non-coinbase transactions that should be included in the next block\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" \"data\" : \"xxxx\", (string) transaction data encoded in hexadecimal (byte-for-byte)\n"
|
" \"data\" : \"xxxx\", (string) transaction data encoded in hexadecimal (byte-for-byte)\n"
|
||||||
" \"hash\" : \"xxxx\", (string) hash/id encoded in little-endian hexadecimal\n"
|
" \"hash\" : \"xxxx\", (string) hash/id encoded in little-endian hexadecimal\n"
|
||||||
|
@ -706,6 +707,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
||||||
result.push_back(Pair("capabilities", aCaps));
|
result.push_back(Pair("capabilities", aCaps));
|
||||||
result.push_back(Pair("version", pblock->nVersion));
|
result.push_back(Pair("version", pblock->nVersion));
|
||||||
result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex()));
|
result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex()));
|
||||||
|
result.push_back(Pair("finalsaplingroothash", pblock->hashFinalSaplingRoot.GetHex()));
|
||||||
result.push_back(Pair("transactions", transactions));
|
result.push_back(Pair("transactions", transactions));
|
||||||
if (coinbasetxn) {
|
if (coinbasetxn) {
|
||||||
assert(txCoinbase.isObject());
|
assert(txCoinbase.isObject());
|
||||||
|
|
Loading…
Reference in New Issue