getblocktemplate fails for old clients after segwit activation #9841

issue jnewbery openend this issue on February 23, 2017
  1. jnewbery commented at 7:05 pm on February 23, 2017: member

    segwit.py is supposed to test that “non-segwit miners get a valid GBT response after the fork”:

     0        print("Verify non-segwit miners get a valid GBT response after the fork")
     1        send_to_witness(1, self.nodes[0], find_unspent(self.nodes[0], 50), self.pubkey[0], False, Decimal("49.998"))
     2        try:
     3            tmpl = self.nodes[0].getblocktemplate({})
     4            assert(len(tmpl['transactions']) == 1)  # Doesn't include witness tx
     5            assert(tmpl['sigoplimit'] == 20000)
     6            assert(tmpl['transactions'][0]['hash'] == txid)
     7            assert(tmpl['transactions'][0]['sigops'] == 2)
     8            assert(('!segwit' in tmpl['rules']) or ('segwit' not in tmpl['rules']))
     9        except JSONRPCException:
    10            # This is an acceptable outcome
    11            pass
    

    in fact what happens is that bitcoind returns a “Support for ‘segwit’ rule requires explicit client support” error to the getblocktemplate RPC. We always catch that error in the except: block and continue the test. None of the asserts in the try: branch are ever tested.

    I don’t know what the intent here is. I would expect non-segwit miners to continue to be able to use getblocktemplate after segwit activation. If that’s true, then there’s a bug in getblocktemplate(). If miners aren’t supposed to be able use getblocktemplate() after segwit activation without setting the rules:[‘segwit’] option, then we should explicitly test that as follows:

    0        assert_raises_jsonrpc(-8, "Support for 'segwit' rule requires explicit client support", self.nodes[0].getblocktemplate, {})
    

    and remove all the test code that isn’t being used.

  2. jnewbery commented at 7:05 pm on February 23, 2017: member
  3. luke-jr commented at 10:10 pm on February 23, 2017: member
    It’s possible to support GBT for non-segwit miners after segwit activates, but Core currently does not. The test passes so long as it isn’t giving a broken result.
  4. jnewbery commented at 10:15 pm on February 23, 2017: member
    Makes sense. I’ll remove the try branch. If Core does support GBT for non-segwit miners in future, a test case should be added as part of that PR.
  5. laanwj closed this on Mar 6, 2017

  6. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-18 00:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me