Skip to content

Commit ed3740e

Browse files
authored
Update routes.py
1 parent 32f32fe commit ed3740e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/routes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ def detect_query_type(query):
195195
query = query.strip().lower()
196196

197197
# Bitcoin address pattern (starts with 1, 3, or bc1)
198-
if re.match(r'^(1|3|bc1)[a-zA-Z0-9]{25,39}$', query):
198+
# Legacy: 26–35 chars, Bech32: up to 62 chars
199+
if re.match(r'^(1|3)[a-zA-Z0-9]{25,39}$', query):
200+
return 'address'
201+
if re.match(r'^(bc1)[a-z0-9]{11,59}$', query): # bc1 + 11–59 → From 14 to 62
199202
return 'address'
200203

201204
# Transaction hash pattern (64 hex characters)

0 commit comments

Comments
 (0)