Skip to content

Commit

Permalink
Merge pull request #84 from BitGo/BTC-1143
Browse files Browse the repository at this point in the history
feat: remove future-segwit warning
  • Loading branch information
davidkaplanbitgo authored May 1, 2024
2 parents 3204ec0 + f6d9e0b commit 4a530b7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
7 changes: 0 additions & 7 deletions src/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ const FUTURE_SEGWIT_MIN_SIZE = 2;
const FUTURE_SEGWIT_MAX_VERSION = 16;
const FUTURE_SEGWIT_MIN_VERSION = 1;
const FUTURE_SEGWIT_VERSION_DIFF = 0x50;
const FUTURE_SEGWIT_VERSION_WARNING =
'WARNING: Sending to a future segwit version address can lead to loss of funds. ' +
'End users MUST be warned carefully in the GUI and asked if they wish to proceed ' +
'with caution. Wallets should verify the segwit version from the output of fromBech32, ' +
'then decide when it is safe to use which version of segwit.';
function _toFutureSegwitAddress(output, network) {
const data = output.slice(2);
if (
Expand All @@ -33,7 +28,6 @@ function _toFutureSegwitAddress(output, network) {
throw new TypeError('Invalid version for segwit address');
if (output[1] !== data.length)
throw new TypeError('Invalid script for segwit address');
console.warn(FUTURE_SEGWIT_VERSION_WARNING);
if (!network.bech32) {
throw new TypeError("Network doesn't support native segwit");
}
Expand Down Expand Up @@ -141,7 +135,6 @@ function toOutputScript(address, network) {
decodeBech32.data.length >= FUTURE_SEGWIT_MIN_SIZE &&
decodeBech32.data.length <= FUTURE_SEGWIT_MAX_SIZE
) {
console.warn(FUTURE_SEGWIT_VERSION_WARNING);
return bscript.compile([
decodeBech32.version + FUTURE_SEGWIT_VERSION_DIFF,
decodeBech32.data,
Expand Down
9 changes: 0 additions & 9 deletions ts_src/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ const FUTURE_SEGWIT_MIN_SIZE: number = 2;
const FUTURE_SEGWIT_MAX_VERSION: number = 16;
const FUTURE_SEGWIT_MIN_VERSION: number = 1;
const FUTURE_SEGWIT_VERSION_DIFF: number = 0x50;
const FUTURE_SEGWIT_VERSION_WARNING: string =
'WARNING: Sending to a future segwit version address can lead to loss of funds. ' +
'End users MUST be warned carefully in the GUI and asked if they wish to proceed ' +
'with caution. Wallets should verify the segwit version from the output of fromBech32, ' +
'then decide when it is safe to use which version of segwit.';

function _toFutureSegwitAddress(output: Buffer, network: Network): string {
const data = output.slice(2);
Expand All @@ -49,8 +44,6 @@ function _toFutureSegwitAddress(output: Buffer, network: Network): string {
if (output[1] !== data.length)
throw new TypeError('Invalid script for segwit address');

console.warn(FUTURE_SEGWIT_VERSION_WARNING);

if (!network.bech32) {
throw new TypeError("Network doesn't support native segwit");
}
Expand Down Expand Up @@ -178,8 +171,6 @@ export function toOutputScript(address: string, network?: Network): Buffer {
decodeBech32.data.length >= FUTURE_SEGWIT_MIN_SIZE &&
decodeBech32.data.length <= FUTURE_SEGWIT_MAX_SIZE
) {
console.warn(FUTURE_SEGWIT_VERSION_WARNING);

return bscript.compile([
decodeBech32.version + FUTURE_SEGWIT_VERSION_DIFF,
decodeBech32.data,
Expand Down

0 comments on commit 4a530b7

Please sign in to comment.