Skip to content

Commit

Permalink
feat: mxc_txpool block addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
luanxu-mxc committed Aug 19, 2023
1 parent f28e4fe commit 1221351
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions eth/mxc_api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,30 @@ func filterBlockedTxs(pendings map[common.Address]types.Transactions, blockedAdd
if len(blockedAddresses) == 0 {
return pendings
}
var localsAddresses []common.Address
var ignoreAddresses []common.Address
for _, account := range blockedAddresses {
if trimmed := strings.TrimSpace(account); !common.IsHexAddress(trimmed) {
log.Warn(fmt.Sprintf("Invalid address: %s", trimmed))
} else {
localsAddresses = append(localsAddresses, common.HexToAddress(account))
ignoreAddresses = append(ignoreAddresses, common.HexToAddress(account))
}
}
executableTxs := make(map[common.Address]types.Transactions)

for addr, txs := range pendings {
pendingTxs := make(types.Transactions, 0)

for _, blockedAddress := range localsAddresses {
blocked := false
for _, blockedAddress := range ignoreAddresses {
if addr == blockedAddress {
log.Debug(fmt.Sprintf("Ignore blocked address: %s", addr.Hex()))
blocked = true
break
}
}
if blocked {
continue
}
for _, tx := range txs {
pendingTxs = append(pendingTxs, tx)
}
Expand Down

0 comments on commit 1221351

Please sign in to comment.