1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 13:38:12 +00:00
trezor-firmware/tools/check-bitcoin-only
matejcik f34ad3daf1 fix: correctly detect all altcoin names in check-bitcoin-only
The -d multi-select picks only coins that are available on _all_ models.
Besides, it's more correct to check even for unsupported altcoins.
2024-03-08 13:17:12 +01:00

36 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
RETURN=0
EXCEPTIONS=()
EXCEPTIONS+=( "decred" ) # "decred" figures in field names used by the bitcoin app
EXCEPTIONS+=( "omni" ) # OMNI is part of the bitcoin app
# BIP39 or SLIP39 words that have "dash" in them
EXCEPTIONS+=( "dash" )
EXCEPTIONS+=( "confirm_ethereum_tx" "confirm_ethereum_staking_tx" ) # model-specific, so is in layout/__init__.py instead of ethereum/layout.py
EXCEPTIONS+=( "__" ) # ignoring the translations blob (section__key delimiter)
EXCEPTIONS+=( "{}" "{0}" ) # ignoring the translations blob (template identifier)
GREP_ARGS=()
for exception in "${EXCEPTIONS[@]}"; do
GREP_ARGS+=(-e $exception)
done
# dump all coins except the first 3 (Bitcoin, Testnet, Regtest), exclude names with less than 4 characters
ALTCOINS=$(./common/tools/cointool.py dump -l -p -t | grep '"name"' | cut -d '"' -f 4 | tail -n +4 | awk 'length($0)>3')
# split on newlines only
OLDIFS=$IFS
IFS="
"
for altcoin in $ALTCOINS; do
# echo :"$altcoin":
if strings "$1" | grep -i "$altcoin" | grep -vi ${GREP_ARGS[@]} ; then
RETURN=1
fi
done
IFS=$OLDIFS
if [ $RETURN -ne 0 ]; then
echo "ERROR: Altcoin strings found in Bitcoin-only firmware."
fi
exit $RETURN