Skip to content

Commit

Permalink
Merge #1111: getblockchaininfo: remove incorrect signblock fields
Browse files Browse the repository at this point in the history
efdb2f4 getblockchaininfo: remove incorrect fields 'signblock_asm' and 'signblock_hex' from rpc response (James Dorfman)

Pull request description:

  Fixes #1109.

  To summarize, there are currently two similar sets of fields in the `getblockchaininfo` RPC response which purport to describe the network's current blocksigning script:

  ```
  $ elements-cli getblockchaininfo
  {
    "chain": "liquidv1",
    "blocks": 1808648,
    ...
    "signblock_asm": "11 026a2a106ec32c8a1e8052e5d02a7b0a150423dbd9b116fc48d46630ff6e6a05b9 02791646a8b49c2740352b4495c118d876347bf47d0551c01c4332fdc2df526f1a 02888bda53a424466b0451627df22090143bbf7c060e9eacb1e38426f6b07f2ae1 02aee8967150dee220f613de3b239320355a498808084a93eaf39a34dcd6202485 02d46e9259d0a0bb2bcbc461a3e68f34adca27b8d08fbe985853992b4b104e2741 02e9944e35e5750ab621e098145b8e6cf373c273b7c04747d1aa020be0af40ccd6 02f9a9d4b10a6d6c56d8c955c547330c589bb45e774551d46d415e51cd9ad51163 033b421566c124dfde4db9defe4084b7aa4e7f36744758d92806b8f72c2e943309 0353dcc6b4cf6ad28aceb7f7b2db92a4bf07ac42d357adf756f3eca790664314b6 037f55980af0455e4fb55aad9b85a55068bb6dc4740ea87276dc693f4598db45fa 0384001daa88dabd23db878dbb1ce5b4c2a5fa72c3113e3514bf602325d0c37b8e 039056d089f2fe72dbc0a14780b4635b0dc8a1b40b7a59106325dd1bc45cc70493 0397ab8ea7b0bf85bc7fc56bb27bf85e75502e94e76a6781c409f3f2ec3d112219 03b00e3b5b77884bf3cae204c4b4eac003601da75f96982ffcb3dcb29c5ee419b9 03c1f3c0874cfe34b8131af34699589aacec4093399739ae352e8a46f80a6f6837 15 OP_CHECKMULTISIG",
    "signblock_hex": "5b21026a2a106ec32c8a1e8052e5d02a7b0a150423dbd9b116fc48d46630ff6e6a05b92102791646a8b49c2740352b4495c118d876347bf47d0551c01c4332fdc2df526f1a2102888bda53a424466b0451627df22090143bbf7c060e9eacb1e38426f6b07f2ae12102aee8967150dee220f613de3b239320355a498808084a93eaf39a34dcd62024852102d46e9259d0a0bb2bcbc461a3e68f34adca27b8d08fbe985853992b4b104e27412102e9944e35e5750ab621e098145b8e6cf373c273b7c04747d1aa020be0af40ccd62102f9a9d4b10a6d6c56d8c955c547330c589bb45e774551d46d415e51cd9ad5116321033b421566c124dfde4db9defe4084b7aa4e7f36744758d92806b8f72c2e943309210353dcc6b4cf6ad28aceb7f7b2db92a4bf07ac42d357adf756f3eca790664314b621037f55980af0455e4fb55aad9b85a55068bb6dc4740ea87276dc693f4598db45fa210384001daa88dabd23db878dbb1ce5b4c2a5fa72c3113e3514bf602325d0c37b8e21039056d089f2fe72dbc0a14780b4635b0dc8a1b40b7a59106325dd1bc45cc70493210397ab8ea7b0bf85bc7fc56bb27bf85e75502e94e76a6781c409f3f2ec3d1122192103b00e3b5b77884bf3cae204c4b4eac003601da75f96982ffcb3dcb29c5ee419b92103c1f3c0874cfe34b8131af34699589aacec4093399739ae352e8a46f80a6f68375fae",
    ...
    "current_signblock_asm": "0 e51211e91d9cf4aec3bdc370a0303acde5d24baedb12235fdd2786885069d91c",
    "current_signblock_hex": "0020e51211e91d9cf4aec3bdc370a0303acde5d24baedb12235fdd2786885069d91c",
    ...
  }
  ```

  The `signblock_asm`/`signblock_hex` fields only display the initial blocksigning script that was used at the time of network genesis. On the other hand, the `current_signblock_asm`/`current_signblock_hex` fields actually show the blocksigning script that is currently being used on the network, and these values change as expected following dynafed transitions.

  The `signblock_asm`/`signblock_hex` fields are currently misleading, and they will become entirely incorrect following future dynafed transitions that modify the `signblockscript`.

  I have considered the following options:
  * Rename these fields to `initial_signblock_asm`/`initial_signblock_hex`
  * Remove the fields entirely

  In this PR I have removed them entirely, because I don't think they serve any use. However, this will be a breaking change. As such, I am also open to simply renaming them.

ACKs for top commit:
  stevenroose:
    utACK efdb2f4

Tree-SHA512: 626017ebf3014a78460a3e148b7405e870f3c9f358ce8b02becac77a3d43ac2be91242e08c580b763ee38f531815c2e9034ad00c87fcff176a2d689a1b7176af
  • Loading branch information
stevenroose committed Jun 6, 2022
2 parents 80862ff + efdb2f4 commit 03b8b0c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 11 deletions.
4 changes: 1 addition & 3 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1444,10 +1444,8 @@ RPCHelpMan getblockchaininfo()
obj.pushKV("size_on_disk", CalculateCurrentUsage());
obj.pushKV("pruned", fPruneMode);
if (g_signed_blocks) {
CScript sign_block_script = chainparams.GetConsensus().signblockscript;
obj.pushKV("signblock_asm", ScriptToAsmStr(sign_block_script));
obj.pushKV("signblock_hex", HexStr(sign_block_script));
if (!IsDynaFedEnabled(::ChainActive().Tip(), chainparams.GetConsensus())) {
CScript sign_block_script = chainparams.GetConsensus().signblockscript;
obj.pushKV("current_signblock_asm", ScriptToAsmStr(sign_block_script));
obj.pushKV("current_signblock_hex", HexStr(sign_block_script));
obj.pushKV("max_block_witness", (uint64_t)chainparams.GetConsensus().max_block_signature_size);
Expand Down
5 changes: 0 additions & 5 deletions test/functional/feature_blocksign.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ def mine_block(self, make_transactions):
if is_dyna:
wsh_wrap = self.nodes[0].decodescript(self.witnessScript)['segwit']['hex']
assert_equal(wsh_wrap, blockchain_info['current_signblock_hex'])
assert blockchain_info['current_signblock_hex'] != blockchain_info['signblock_hex']

# Make a few transactions to make non-empty blocks for compact transmission
if make_transactions:
Expand Down Expand Up @@ -207,10 +206,6 @@ def run_test(self):
assert 'signblock_witness_asm' in block
assert 'signblock_witness_hex' in block

signblockscript = make_signblockscript(self.num_keys, self.required_signers, self.keys)
assert_equal(info['signblock_asm'], self.nodes[0].decodescript(signblockscript)['asm'])
assert_equal(info['signblock_hex'], signblockscript)

assert_equal(info['softforks']['dynafed']['bip9']['status'], "defined")

# Next let's activate dynafed
Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_dynafed.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def test_legacy_params(self):

# blocksigner is OP_TRUE, extension space is hardcoded one in chainparams
signblock_info = self.nodes[i].getblockchaininfo()
assert_equal(signblock_info["signblock_hex"], "51")
assert_equal(signblock_info["current_signblock_hex"], "51")
assert_equal(signblock_info["max_block_witness"], 74)
assert_equal(signblock_info["extension_space"], initial_extension)
Expand Down
2 changes: 0 additions & 2 deletions test/functional/rpc_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ def _test_getblockchaininfo(self):
'max_block_witness',
'mediantime',
'pruned',
'signblock_asm',
'signblock_hex',
'size_on_disk',
'softforks',
'verificationprogress',
Expand Down

0 comments on commit 03b8b0c

Please sign in to comment.