mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-13 03:30:42 +02:00
test: add more functional tests for setfeerate
Was: test: update functional tests from settxfee to setfeerate Github-Pull: #20391 Rebased-From: d87f0f3a923dca2ce8d99aa700b0beda8e42d3ec (partial)
This commit is contained in:
parent
f3bd5963ac
commit
7da90bbfc5
@ -58,6 +58,7 @@ class CreateTxWalletTest(BitcoinTestFramework):
|
|||||||
# More than 10kB of outputs, so that we hit -maxtxfee with a high feerate
|
# More than 10kB of outputs, so that we hit -maxtxfee with a high feerate
|
||||||
outputs = {self.nodes[0].getnewaddress(address_type='bech32'): 0.000025 for _ in range(400)}
|
outputs = {self.nodes[0].getnewaddress(address_type='bech32'): 0.000025 for _ in range(400)}
|
||||||
raw_tx = self.nodes[0].createrawtransaction(inputs=[], outputs=outputs)
|
raw_tx = self.nodes[0].createrawtransaction(inputs=[], outputs=outputs)
|
||||||
|
msg = "Fee exceeds maximum configured by user (e.g. -maxtxfee, maxfeerate)"
|
||||||
|
|
||||||
for fee_setting in ['-minrelaytxfee=0.01', '-mintxfee=0.01', '-paytxfee=0.01']:
|
for fee_setting in ['-minrelaytxfee=0.01', '-mintxfee=0.01', '-paytxfee=0.01']:
|
||||||
self.log.info('Check maxtxfee in combination with {}'.format(fee_setting))
|
self.log.info('Check maxtxfee in combination with {}'.format(fee_setting))
|
||||||
@ -88,6 +89,12 @@ class CreateTxWalletTest(BitcoinTestFramework):
|
|||||||
)
|
)
|
||||||
self.nodes[0].settxfee(0)
|
self.nodes[0].settxfee(0)
|
||||||
|
|
||||||
|
self.log.info('Check maxtxfee in combination with setfeerate (sat/vB)')
|
||||||
|
self.nodes[0].setfeerate(1000)
|
||||||
|
assert_raises_rpc_error(-6, msg, self.nodes[0].sendmany, dummy="", amounts=outputs)
|
||||||
|
assert_raises_rpc_error(-4, msg, self.nodes[0].fundrawtransaction, hexstring=raw_tx)
|
||||||
|
self.nodes[0].setfeerate(0)
|
||||||
|
|
||||||
def test_create_too_long_mempool_chain(self):
|
def test_create_too_long_mempool_chain(self):
|
||||||
self.log.info('Check too-long mempool chain error')
|
self.log.info('Check too-long mempool chain error')
|
||||||
df_wallet = self.nodes[0].get_wallet_rpc(self.default_wallet_name)
|
df_wallet = self.nodes[0].get_wallet_rpc(self.default_wallet_name)
|
||||||
|
@ -250,12 +250,18 @@ class MultiWalletTest(BitcoinTestFramework):
|
|||||||
assert_equal(batch[0]["result"]["chain"], self.chain)
|
assert_equal(batch[0]["result"]["chain"], self.chain)
|
||||||
assert_equal(batch[1]["result"]["walletname"], "w1")
|
assert_equal(batch[1]["result"]["walletname"], "w1")
|
||||||
|
|
||||||
self.log.info('Check for per-wallet settxfee call')
|
self.log.info('Test per-wallet setfeerate and settxfee calls')
|
||||||
assert_equal(w1.getwalletinfo()['paytxfee'], 0)
|
assert_equal(w1.getwalletinfo()['paytxfee'], 0)
|
||||||
assert_equal(w2.getwalletinfo()['paytxfee'], 0)
|
assert_equal(w2.getwalletinfo()['paytxfee'], 0)
|
||||||
|
w2.setfeerate(200)
|
||||||
|
assert_equal(w1.getwalletinfo()['paytxfee'], 0)
|
||||||
|
assert_equal(w2.getwalletinfo()['paytxfee'], Decimal('0.00200000'))
|
||||||
w2.settxfee(0.001)
|
w2.settxfee(0.001)
|
||||||
assert_equal(w1.getwalletinfo()['paytxfee'], 0)
|
assert_equal(w1.getwalletinfo()['paytxfee'], 0)
|
||||||
assert_equal(w2.getwalletinfo()['paytxfee'], Decimal('0.00100000'))
|
assert_equal(w2.getwalletinfo()['paytxfee'], Decimal('0.00100000'))
|
||||||
|
w1.setfeerate(30)
|
||||||
|
assert_equal(w1.getwalletinfo()['paytxfee'], Decimal('0.00030000'))
|
||||||
|
assert_equal(w2.getwalletinfo()['paytxfee'], Decimal('0.00100000'))
|
||||||
|
|
||||||
self.log.info("Test dynamic wallet loading")
|
self.log.info("Test dynamic wallet loading")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user