mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
merge bitcoin#23207: Delete generate* calls from TestNode
This commit is contained in:
parent
7d3c3b4b64
commit
3dcd87506e
@ -767,19 +767,19 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
self.sync_all()
|
||||
|
||||
def generate(self, generator, *args, **kwargs):
|
||||
blocks = generator.generate(*args, **kwargs)
|
||||
blocks = generator.generate(*args, invalid_call=False, **kwargs)
|
||||
return blocks
|
||||
|
||||
def generateblock(self, generator, *args, **kwargs):
|
||||
blocks = generator.generateblock(*args, **kwargs)
|
||||
blocks = generator.generateblock(*args, invalid_call=False, **kwargs)
|
||||
return blocks
|
||||
|
||||
def generatetoaddress(self, generator, *args, **kwargs):
|
||||
blocks = generator.generatetoaddress(*args, **kwargs)
|
||||
blocks = generator.generatetoaddress(*args, invalid_call=False, **kwargs)
|
||||
return blocks
|
||||
|
||||
def generatetodescriptor(self, generator, *args, **kwargs):
|
||||
blocks = generator.generatetodescriptor(*args, **kwargs)
|
||||
blocks = generator.generatetodescriptor(*args, invalid_call=False, **kwargs)
|
||||
return blocks
|
||||
|
||||
def sync_blocks(self, nodes=None, wait=1, timeout=60):
|
||||
|
@ -317,9 +317,21 @@ class TestNode():
|
||||
time.sleep(1.0 / poll_per_s)
|
||||
self._raise_assertion_error("Unable to retrieve cookie credentials after {}s".format(self.rpc_timeout))
|
||||
|
||||
def generate(self, nblocks, maxtries=1000000):
|
||||
def generate(self, nblocks, maxtries=1000000, **kwargs):
|
||||
self.log.debug("TestNode.generate() dispatches `generate` call to `generatetoaddress`")
|
||||
return self.generatetoaddress(nblocks=nblocks, address=self.get_deterministic_priv_key().address, maxtries=maxtries)
|
||||
return self.generatetoaddress(nblocks=nblocks, address=self.get_deterministic_priv_key().address, maxtries=maxtries, **kwargs)
|
||||
|
||||
def generateblock(self, *args, invalid_call, **kwargs):
|
||||
assert not invalid_call
|
||||
return self.__getattr__('generateblock')(*args, **kwargs)
|
||||
|
||||
def generatetoaddress(self, *args, invalid_call, **kwargs):
|
||||
assert not invalid_call
|
||||
return self.__getattr__('generatetoaddress')(*args, **kwargs)
|
||||
|
||||
def generatetodescriptor(self, *args, invalid_call, **kwargs):
|
||||
assert not invalid_call
|
||||
return self.__getattr__('generatetodescriptor')(*args, **kwargs)
|
||||
|
||||
def get_wallet_rpc(self, wallet_name):
|
||||
if self.use_cli:
|
||||
|
@ -114,9 +114,9 @@ class MiniWallet:
|
||||
break
|
||||
tx.vin[0].scriptSig = CScript([der_sig + bytes(bytearray([SIGHASH_ALL]))])
|
||||
|
||||
def generate(self, num_blocks):
|
||||
def generate(self, num_blocks, **kwargs):
|
||||
"""Generate blocks with coinbase outputs to the internal address, and append the outputs to the internal list"""
|
||||
blocks = self._test_node.generatetodescriptor(num_blocks, self.get_descriptor())
|
||||
blocks = self._test_node.generatetodescriptor(num_blocks, self.get_descriptor(), **kwargs)
|
||||
for b in blocks:
|
||||
block_info = self._test_node.getblock(blockhash=b, verbosity=2)
|
||||
cb_tx = block_info['tx'][0]
|
||||
|
@ -63,7 +63,7 @@ class WalletDescriptorTest(BitcoinTestFramework):
|
||||
send_wrpc = self.nodes[0].get_wallet_rpc("desc1")
|
||||
|
||||
# Generate some coins
|
||||
self.generatetoaddress(send_wrpc, 101, send_wrpc.getnewaddress())
|
||||
self.generatetoaddress(self.nodes[0], 101, send_wrpc.getnewaddress())
|
||||
|
||||
# Make transactions
|
||||
self.log.info("Test sending and receiving")
|
||||
|
@ -73,7 +73,7 @@ class ImportDescriptorsTest(BitcoinTestFramework):
|
||||
assert_equal(wpriv.getwalletinfo()['keypoolsize'], 0)
|
||||
|
||||
self.log.info('Mining coins')
|
||||
self.generatetoaddress(w0, 101, w0.getnewaddress())
|
||||
self.generatetoaddress(self.nodes[0], 101, w0.getnewaddress())
|
||||
|
||||
# RPC importdescriptors -----------------------------------------------
|
||||
|
||||
@ -380,7 +380,7 @@ class ImportDescriptorsTest(BitcoinTestFramework):
|
||||
solvable=True,
|
||||
ismine=True)
|
||||
txid = w0.sendtoaddress(address, 49.99995540)
|
||||
self.generatetoaddress(w0, 6, w0.getnewaddress())
|
||||
self.generatetoaddress(self.nodes[0], 6, w0.getnewaddress())
|
||||
self.sync_blocks()
|
||||
tx = wpriv.createrawtransaction([{"txid": txid, "vout": 0}], {w0.getnewaddress(): 49.999})
|
||||
signed_tx = wpriv.signrawtransactionwithwallet(tx)
|
||||
|
Loading…
Reference in New Issue
Block a user