mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
test: Call generate through test framework only
This commit is contained in:
parent
2eccb8bc5e
commit
fa6e599cf9
3 changed files with 9 additions and 9 deletions
|
@ -325,7 +325,7 @@ class EphemeralDustTest(BitcoinTestFramework):
|
||||||
dusty_tx, _ = self.create_ephemeral_dust_package(tx_version=3)
|
dusty_tx, _ = self.create_ephemeral_dust_package(tx_version=3)
|
||||||
assert_raises_rpc_error(-26, "min relay fee not met", self.nodes[0].sendrawtransaction, dusty_tx["hex"])
|
assert_raises_rpc_error(-26, "min relay fee not met", self.nodes[0].sendrawtransaction, dusty_tx["hex"])
|
||||||
|
|
||||||
block_res = self.nodes[0].rpc.generateblock(self.wallet.get_address(), [dusty_tx["hex"]])
|
block_res = self.generateblock(self.nodes[0], self.wallet.get_address(), [dusty_tx["hex"]], sync_fun=self.no_op)
|
||||||
self.nodes[0].invalidateblock(block_res["hash"])
|
self.nodes[0].invalidateblock(block_res["hash"])
|
||||||
assert_mempool_contents(self, self.nodes[0], expected=[dusty_tx["tx"]], sync=False)
|
assert_mempool_contents(self, self.nodes[0], expected=[dusty_tx["tx"]], sync=False)
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ class EphemeralDustTest(BitcoinTestFramework):
|
||||||
assert_raises_rpc_error(-26, "min relay fee not met", self.nodes[0].sendrawtransaction, sweep_tx["hex"])
|
assert_raises_rpc_error(-26, "min relay fee not met", self.nodes[0].sendrawtransaction, sweep_tx["hex"])
|
||||||
|
|
||||||
# Mine the sweep then re-org, the sweep will not make it back in due to spend checks
|
# Mine the sweep then re-org, the sweep will not make it back in due to spend checks
|
||||||
block_res = self.nodes[0].rpc.generateblock(self.wallet.get_address(), [dusty_tx["hex"], sweep_tx["hex"]])
|
block_res = self.generateblock(self.nodes[0], self.wallet.get_address(), [dusty_tx["hex"], sweep_tx["hex"]], sync_fun=self.no_op)
|
||||||
self.nodes[0].invalidateblock(block_res["hash"])
|
self.nodes[0].invalidateblock(block_res["hash"])
|
||||||
assert_mempool_contents(self, self.nodes[0], expected=[dusty_tx["tx"]], sync=False)
|
assert_mempool_contents(self, self.nodes[0], expected=[dusty_tx["tx"]], sync=False)
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ class EphemeralDustTest(BitcoinTestFramework):
|
||||||
self.add_output_to_create_multi_result(sweep_tx_2)
|
self.add_output_to_create_multi_result(sweep_tx_2)
|
||||||
assert_raises_rpc_error(-26, "min relay fee not met", self.nodes[0].sendrawtransaction, sweep_tx_2["hex"])
|
assert_raises_rpc_error(-26, "min relay fee not met", self.nodes[0].sendrawtransaction, sweep_tx_2["hex"])
|
||||||
|
|
||||||
reconsider_block_res = self.nodes[0].rpc.generateblock(self.wallet.get_address(), [dusty_tx["hex"], sweep_tx_2["hex"]])
|
reconsider_block_res = self.generateblock(self.nodes[0], self.wallet.get_address(), [dusty_tx["hex"], sweep_tx_2["hex"]], sync_fun=self.no_op)
|
||||||
self.nodes[0].invalidateblock(reconsider_block_res["hash"])
|
self.nodes[0].invalidateblock(reconsider_block_res["hash"])
|
||||||
assert_mempool_contents(self, self.nodes[0], expected=[dusty_tx["tx"], sweep_tx_2["tx"]], sync=False)
|
assert_mempool_contents(self, self.nodes[0], expected=[dusty_tx["tx"], sweep_tx_2["tx"]], sync=False)
|
||||||
|
|
||||||
|
@ -357,13 +357,13 @@ class EphemeralDustTest(BitcoinTestFramework):
|
||||||
|
|
||||||
self.log.info("Test that ephemeral dust tx with fees or multi dust don't enter mempool via reorg")
|
self.log.info("Test that ephemeral dust tx with fees or multi dust don't enter mempool via reorg")
|
||||||
multi_dusty_tx, _ = self.create_ephemeral_dust_package(tx_version=3, num_dust_outputs=2)
|
multi_dusty_tx, _ = self.create_ephemeral_dust_package(tx_version=3, num_dust_outputs=2)
|
||||||
block_res = self.nodes[0].rpc.generateblock(self.wallet.get_address(), [multi_dusty_tx["hex"]])
|
block_res = self.generateblock(self.nodes[0], self.wallet.get_address(), [multi_dusty_tx["hex"]], sync_fun=self.no_op)
|
||||||
self.nodes[0].invalidateblock(block_res["hash"])
|
self.nodes[0].invalidateblock(block_res["hash"])
|
||||||
assert_equal(self.nodes[0].getrawmempool(), [])
|
assert_equal(self.nodes[0].getrawmempool(), [])
|
||||||
|
|
||||||
# With fee and one dust
|
# With fee and one dust
|
||||||
dusty_fee_tx, _ = self.create_ephemeral_dust_package(tx_version=3, dust_tx_fee=1)
|
dusty_fee_tx, _ = self.create_ephemeral_dust_package(tx_version=3, dust_tx_fee=1)
|
||||||
block_res = self.nodes[0].rpc.generateblock(self.wallet.get_address(), [dusty_fee_tx["hex"]])
|
block_res = self.generateblock(self.nodes[0], self.wallet.get_address(), [dusty_fee_tx["hex"]], sync_fun=self.no_op)
|
||||||
self.nodes[0].invalidateblock(block_res["hash"])
|
self.nodes[0].invalidateblock(block_res["hash"])
|
||||||
assert_equal(self.nodes[0].getrawmempool(), [])
|
assert_equal(self.nodes[0].getrawmempool(), [])
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class GetBlocksActivityTest(BitcoinTestFramework):
|
||||||
node = self.nodes[0]
|
node = self.nodes[0]
|
||||||
wallet = MiniWallet(node)
|
wallet = MiniWallet(node)
|
||||||
node.setmocktime(node.getblockheader(node.getbestblockhash())['time'])
|
node.setmocktime(node.getblockheader(node.getbestblockhash())['time'])
|
||||||
wallet.generate(200, invalid_call=False)
|
self.generate(wallet, 200)
|
||||||
|
|
||||||
self.test_no_activity(node)
|
self.test_no_activity(node)
|
||||||
self.test_activity_in_block(node, wallet)
|
self.test_activity_in_block(node, wallet)
|
||||||
|
@ -195,7 +195,7 @@ class GetBlocksActivityTest(BitcoinTestFramework):
|
||||||
|
|
||||||
def test_no_address(self, node, wallet):
|
def test_no_address(self, node, wallet):
|
||||||
raw_wallet = MiniWallet(self.nodes[0], mode=MiniWalletMode.RAW_P2PK)
|
raw_wallet = MiniWallet(self.nodes[0], mode=MiniWalletMode.RAW_P2PK)
|
||||||
raw_wallet.generate(100, invalid_call=False)
|
self.generate(raw_wallet, 100)
|
||||||
|
|
||||||
no_addr_tx = raw_wallet.send_self_transfer(from_node=node)
|
no_addr_tx = raw_wallet.send_self_transfer(from_node=node)
|
||||||
raw_desc = raw_wallet.get_descriptor()
|
raw_desc = raw_wallet.get_descriptor()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Copyright (c) 2020-2022 The Bitcoin Core developers
|
# Copyright (c) 2020-present The Bitcoin Core developers
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
"""Test Migrating a wallet from legacy to descriptor."""
|
"""Test Migrating a wallet from legacy to descriptor."""
|
||||||
|
@ -461,7 +461,7 @@ class WalletMigrationTest(BitcoinTestFramework):
|
||||||
addr_info = wallet.getaddressinfo(addr)
|
addr_info = wallet.getaddressinfo(addr)
|
||||||
desc = descsum_create("pk(" + addr_info["pubkey"] + ")")
|
desc = descsum_create("pk(" + addr_info["pubkey"] + ")")
|
||||||
|
|
||||||
self.master_node.generatetodescriptor(1, desc, invalid_call=False)
|
self.generatetodescriptor(self.master_node, 1, desc)
|
||||||
|
|
||||||
bals = wallet.getbalances()
|
bals = wallet.getbalances()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue