Skip to content

Commit 0f9424d

Browse files
fix(rpc-integration-test): provision dedicated UTXO for sign+send test
Send 3 DASH to a fresh wallet address and mine 6 blocks, then select that UTXO (minconf=6, min amount=2). Avoids reliance on earlier test ordering and coinbase maturity, eliminating intermittent empty listunspent results.
1 parent e241301 commit 0f9424d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

rpc-integration-test/src/main.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,10 +784,17 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) {
784784
minimum_amount: Some(btc(2)),
785785
..Default::default()
786786
};
787-
// Ensure we have confirmed spendable UTXOs; mine 6 blocks to confirm mempool sends
787+
// Ensure we have a confirmed, sufficiently large UTXO owned by this wallet.
788+
// 1) Create a fresh funding output of 3 DASH to a new wallet address.
789+
let fund_addr = cl.get_new_address(None).unwrap().require_network(*NET).unwrap();
790+
let _ = cl
791+
.send_to_address(&fund_addr, btc(3), None, None, None, None, None, None, None, None)
792+
.unwrap();
793+
// 2) Mine 6 blocks to confirm all pending transactions (not coinbases).
788794
let mine_addr = cl.get_new_address(None).unwrap().require_network(*NET).unwrap();
789795
let _ = cl.generate_to_address(6, &mine_addr).unwrap();
790-
let unspent = cl.list_unspent(Some(6), None, None, None, Some(options)).unwrap();
796+
// 3) Select a confirmed UTXO >= 2 DASH, preferably the one we just created.
797+
let unspent = cl.list_unspent(Some(6), None, Some(&[&fund_addr]), None, Some(options)).unwrap();
791798
let unspent = unspent.into_iter().next().unwrap();
792799

793800
let tx = Transaction {

0 commit comments

Comments
 (0)