Skip to content

Commit

Permalink
fix(stacking): allow testnet btc address in testnet mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Jan 4, 2021
1 parent d634310 commit b2892f0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/pages/stacking/step/choose-btc-address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import validate from 'bitcoin-address-validation';

import { ErrorText } from '@components/error-text';
import { ErrorLabel } from '@components/error-label';
import { SUPPORTED_BTC_ADDRESS_FORMATS } from '../../../constants/index';
import { NETWORK, SUPPORTED_BTC_ADDRESS_FORMATS } from '@constants/index';

import {
StackingStep,
Expand All @@ -30,7 +30,9 @@ export const ChooseBtcAddressStep: FC<ChooseBtcAddressStepProps> = props => {
validate: ({ btcAddress }) => {
const address = validate(btcAddress);
if (!address) return { btcAddress: 'Invalid BTC address' };
if (address.network === 'testnet') return { btcAddress: 'Testnet addresses not supported' };
if (NETWORK === 'mainnet' && address.network === 'testnet') {
return { btcAddress: 'Testnet addresses not supported' };
}
// https://github.com/blockstack/stacks-blockchain/issues/1902
if (!SUPPORTED_BTC_ADDRESS_FORMATS.includes(address.type as any)) {
return {
Expand Down

0 comments on commit b2892f0

Please sign in to comment.