Skip to content

Commit

Permalink
[Rules] Allow prefix for bitcoin cash addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Jun 21, 2020
1 parent 456198f commit 09a2993
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rules/bitcoin.lua
Expand Up @@ -118,6 +118,11 @@ local function gen_bleach32_table(input)
end

local function is_segwit_bech32_address(word)
local semicolon_pos = string.find(word, ':')
if semicolon_pos then
word = string.sub(word, semicolon_pos + 1)
end

local prefix = word:sub(1, 3)

if prefix == 'bc1' or prefix:sub(1, 1) == '1' or prefix:sub(1, 1) == '3' then
Expand Down Expand Up @@ -168,7 +173,7 @@ rspamd_config:register_symbol{
local rspamd_re = require "rspamd_regexp"

local btc_wallet_re = rspamd_re.create_cached('^[13LM][1-9A-Za-z]{25,34}$')
local segwit_wallet_re = rspamd_re.create_cached('^(?:bc1|[13])?[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{14,}$', 'i')
local segwit_wallet_re = rspamd_re.create_cached('^(?:bc1|[13]|(?:[^:]*:))?[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{14,}$', 'i')
local words_matched = {}
local segwit_words_matched = {}
local valid_wallets = {}
Expand Down

0 comments on commit 09a2993

Please sign in to comment.