Skip to content

Commit af7c9d1

Browse files
promagluke-jr
authored andcommitted
qa: Test fundrawtransaction and walletcreatefundedpsbt with min_conf
Github-Pull: bitcoin#14641 Rebased-From: 4138cb3
1 parent 8070c3f commit af7c9d1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

test/functional/rpc_psbt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ def assert_change_type(self, psbtx, expected_type):
186186

187187
def run_test(self):
188188
# Create and fund a raw tx for sending 10 BTC
189-
psbtx1 = self.nodes[0].walletcreatefundedpsbt([], {self.nodes[2].getnewaddress():10})['psbt']
189+
assert_raises_rpc_error(-4, "Insufficient funds", self.nodes[0].walletcreatefundedpsbt, inputs=[], outputs={self.nodes[2].getnewaddress():1}, options={'min_conf': 201})
190+
psbtx1 = self.nodes[0].walletcreatefundedpsbt(inputs=[], outputs={self.nodes[2].getnewaddress():11}, options={'min_conf': 200})['psbt']
190191

191192
# If inputs are specified, do not automatically add more:
192193
utxo1 = self.nodes[0].listunspent()[0]

test/functional/wallet_fundrawtransaction.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,16 @@ def test_option_subtract_fee_from_outputs(self):
961961
# The total subtracted from the outputs is equal to the fee.
962962
assert_equal(share[0] + share[2] + share[3], result[0]['fee'])
963963

964+
# test funding with custom min_conf
965+
inputs = []
966+
outputs = {self.nodes[2].getnewaddress(): 1}
967+
rawtx = self.nodes[3].createrawtransaction(inputs, outputs)
968+
unspent = self.nodes[3].listunspent()
969+
assert len(unspent) == 1
970+
input_confs = unspent[0]['confirmations']
971+
assert_raises_rpc_error(-4, "Insufficient funds", self.nodes[3].fundrawtransaction, rawtx, {'min_conf': input_confs + 1})
972+
result = self.nodes[3].fundrawtransaction(rawtx, {'min_conf': input_confs})
973+
964974
def test_subtract_fee_with_presets(self):
965975
self.log.info("Test fundrawtxn subtract fee from outputs with preset inputs that are sufficient")
966976

0 commit comments

Comments
 (0)