Skip to content

Commit bba6553

Browse files
committed
fix: limit number of UTXOs retrieved with listunspent
This prevents the response from being too large and exceeding the 16MB limit that we support.
1 parent 4dc2902 commit bba6553

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2599,6 +2599,9 @@ impl BitcoinRPCRequest {
25992599
let min_conf = 0i64;
26002600
let max_conf = 9999999i64;
26012601
let minimum_amount = ParsedUTXO::sat_to_serialized_btc(minimum_sum_amount);
2602+
// Specify the maximum number of UTXOs to get from listunspent, to
2603+
// ensure the response is not too large.
2604+
let maximum_count = 1024;
26022605

26032606
let payload = BitcoinRPCRequest {
26042607
method: "listunspent".to_string(),
@@ -2607,7 +2610,7 @@ impl BitcoinRPCRequest {
26072610
max_conf.into(),
26082611
addresses.into(),
26092612
include_unsafe.into(),
2610-
json!({ "minimumAmount": minimum_amount }),
2613+
json!({ "minimumAmount": minimum_amount, "maximumCount": maximum_count }),
26112614
],
26122615
id: "stacks".to_string(),
26132616
jsonrpc: "2.0".to_string(),

0 commit comments

Comments
 (0)