mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 10:19:26 +02:00
tests for bumpfee / estimate_modes
* invalid parameter tests for bumpfee * add tests for no conf_target explicit estimate_modes
This commit is contained in:
@ -71,6 +71,7 @@ class BumpFeeTest(BitcoinTestFramework):
|
||||
|
||||
self.log.info("Running tests")
|
||||
dest_address = peer_node.getnewaddress()
|
||||
test_invalid_parameters(rbf_node, dest_address)
|
||||
test_simple_bumpfee_succeeds(self, "default", rbf_node, peer_node, dest_address)
|
||||
test_simple_bumpfee_succeeds(self, "fee_rate", rbf_node, peer_node, dest_address)
|
||||
test_feerate_args(self, rbf_node, peer_node, dest_address)
|
||||
@ -92,6 +93,28 @@ class BumpFeeTest(BitcoinTestFramework):
|
||||
test_small_output_with_feerate_succeeds(self, rbf_node, dest_address)
|
||||
test_no_more_inputs_fails(self, rbf_node, dest_address)
|
||||
|
||||
def test_invalid_parameters(node, dest_address):
|
||||
txid = spend_one_input(node, dest_address)
|
||||
# invalid estimate mode
|
||||
assert_raises_rpc_error(-8, "Invalid estimate_mode parameter", node.bumpfee, txid, {
|
||||
"estimate_mode": "moo",
|
||||
})
|
||||
assert_raises_rpc_error(-3, "Expected type string", node.bumpfee, txid, {
|
||||
"estimate_mode": 38,
|
||||
})
|
||||
assert_raises_rpc_error(-3, "Expected type string", node.bumpfee, txid, {
|
||||
"estimate_mode": {
|
||||
"foo": "bar",
|
||||
},
|
||||
})
|
||||
assert_raises_rpc_error(-8, "Invalid estimate_mode parameter", node.bumpfee, txid, {
|
||||
"estimate_mode": Decimal("3.141592"),
|
||||
})
|
||||
# confTarget and conf_target
|
||||
assert_raises_rpc_error(-8, "confTarget and conf_target options should not both be set", node.bumpfee, txid, {
|
||||
"confTarget": 123,
|
||||
"conf_target": 456,
|
||||
})
|
||||
|
||||
def test_simple_bumpfee_succeeds(self, mode, rbf_node, peer_node, dest_address):
|
||||
self.log.info('Test simple bumpfee: {}'.format(mode))
|
||||
@ -127,9 +150,10 @@ def test_feerate_args(self, rbf_node, peer_node, dest_address):
|
||||
self.sync_mempools((rbf_node, peer_node))
|
||||
assert rbfid in rbf_node.getrawmempool() and rbfid in peer_node.getrawmempool()
|
||||
|
||||
assert_raises_rpc_error(-8, "confTarget can't be set with fee_rate. Please provide either a confirmation target in blocks for automatic fee estimation, or an explicit fee rate.", rbf_node.bumpfee, rbfid, {"fee_rate": NORMAL, "confTarget": 1})
|
||||
assert_raises_rpc_error(-8, "conf_target can't be set with fee_rate. Please provide either a confirmation target in blocks for automatic fee estimation, or an explicit fee rate.", rbf_node.bumpfee, rbfid, {"fee_rate": NORMAL, "confTarget": 1})
|
||||
|
||||
assert_raises_rpc_error(-3, "Unexpected key totalFee", rbf_node.bumpfee, rbfid, {"totalFee": NORMAL})
|
||||
assert_raises_rpc_error(-8, "conf_target can't be set with fee_rate. Please provide either a confirmation target in blocks for automatic fee estimation, or an explicit fee rate.", rbf_node.bumpfee, rbfid, {"fee_rate":0.00001, "confTarget": 1})
|
||||
|
||||
# Bumping to just above minrelay should fail to increase total fee enough, at least
|
||||
assert_raises_rpc_error(-8, "Insufficient total fee", rbf_node.bumpfee, rbfid, {"fee_rate": INSUFFICIENT})
|
||||
|
Reference in New Issue
Block a user