Skip to content

Commit

Permalink
test: invalid parameter tests for bumpfee
Browse files Browse the repository at this point in the history
Github-Pull: bitcoin#11413
Rebased-From: d44eec7633d85d3b94914d1de46a442948ee2a78
  • Loading branch information
kallewoof authored and luke-jr committed Oct 25, 2019
1 parent ec3de02 commit 9cd0465
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/functional/wallet_bumpfee.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def run_test(self):

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)
Expand All @@ -89,6 +90,38 @@ def run_test(self):
test_no_more_inputs_fails(rbf_node, dest_address)
self.log.info("Success")

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,
})
# confTarget and totalFee (depends on -deprecatedrpc=totalFee)
assert_raises_rpc_error(-8, "conf_target and totalFee options should not both be set", node.bumpfee, txid, {
"confTarget": 123,
"totalFee": 456,
})
# conf_target and totalFee (depends on -deprecatedrpc=totalFee)
assert_raises_rpc_error(-8, "conf_target and totalFee options should not both be set", node.bumpfee, txid, {
"conf_target": 123,
"totalFee": 456,
})

def test_simple_bumpfee_succeeds(self, mode, rbf_node, peer_node, dest_address):
rbfid = spend_one_input(rbf_node, dest_address)
Expand Down

0 comments on commit 9cd0465

Please sign in to comment.