mirror of
https://github.com/romanz/electrs.git
synced 2026-08-17 13:06:27 +02:00
Only fetch as many txids as needed in order to know that there are too many.
And increase the limit to 100.
This commit is contained in:
parent
30c671d067
commit
0c7a6deea8
1 changed files with 4 additions and 1 deletions
|
|
@ -20,6 +20,8 @@ use util::{FullHash, HashPrefix, HeaderEntry, Bytes, BlockMeta, BlockHeaderMeta,
|
|||
|
||||
use errors::*;
|
||||
|
||||
const FUNDING_TXN_LIMIT: usize = 100;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct FundingOutput {
|
||||
pub txn: Option<TxnHeight>,
|
||||
|
|
@ -183,6 +185,7 @@ fn txids_by_script_hash(store: &ReadStore, script_hash: &[u8]) -> Vec<HashPrefix
|
|||
store
|
||||
.scan(&TxOutRow::filter(script_hash))
|
||||
.iter()
|
||||
.take(FUNDING_TXN_LIMIT+1)
|
||||
.map(|row| TxOutRow::from_row(row).txid_prefix)
|
||||
.collect()
|
||||
}
|
||||
|
|
@ -251,7 +254,7 @@ impl Query {
|
|||
prefixes: Vec<HashPrefix>,
|
||||
) -> Result<Vec<TxnHeight>> {
|
||||
|
||||
if prefixes.len() > 30 {
|
||||
if prefixes.len() > FUNDING_TXN_LIMIT {
|
||||
bail!("Sorry! Addresses with large number of transactions aren't currently supported.");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue