コード例 #1
0
  def test_create_submit_auxblock (self):
    """
    Test the createauxblock / submitauxblock method pair.
    """

    # Check for errors with wrong parameters.
    assert_raises_rpc_error (-1, None, self.nodes[0].createauxblock)
    assert_raises_rpc_error (-5, "Invalid coinbase payout address",
                             self.nodes[0].createauxblock,
                             "this_an_invalid_address")

    # Fix a coinbase address and construct methods for it.
    coinbaseAddr = self.nodes[0].getnewaddress ()
    def create (*algo):
      return self.nodes[0].createauxblock (coinbaseAddr, *algo)
    submit = self.nodes[0].submitauxblock

    # Run common tests.
    self.test_common (create, submit)

    # Ensure that the payout address is the one which we specify
    hash1 = auxpow.mineAuxpowBlockWithMethods (create, submit)
    hash2 = auxpow.mineAuxpowBlockWithMethods (create, submit)
    self.sync_all ()
    addr1 = auxpow.getCoinbaseAddr (self.nodes[1], hash1)
    addr2 = auxpow.getCoinbaseAddr (self.nodes[1], hash2)
    assert_equal (addr1, coinbaseAddr)
    assert_equal (addr2, coinbaseAddr)
コード例 #2
0
  def test_getauxblock (self):
    """
    Test the getauxblock method.
    """

    create = self.nodes[0].getauxblock
    submit = self.nodes[0].getauxblock
    self.test_common (create, submit)

    # Ensure that the payout address is changed from one block to the next.
    hash1 = auxpow.mineAuxpowBlockWithMethods (create, submit)
    hash2 = auxpow.mineAuxpowBlockWithMethods (create, submit)
    self.sync_all ()
    addr1 = auxpow.getCoinbaseAddr (self.nodes[1], hash1)
    addr2 = auxpow.getCoinbaseAddr (self.nodes[1], hash2)
    assert addr1 != addr2
    info = self.nodes[0].getaddressinfo (addr1)
    assert info['ismine']
    info = self.nodes[0].getaddressinfo (addr2)
    assert info['ismine']