Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce warnings about future segwit version when parsing output scripts #1800

Open
woofbotapp opened this issue May 13, 2022 · 8 comments · May be fixed by #2068
Open

Reduce warnings about future segwit version when parsing output scripts #1800

woofbotapp opened this issue May 13, 2022 · 8 comments · May be fixed by #2068

Comments

@woofbotapp
Copy link

woofbotapp commented May 13, 2022

console.warn(FUTURE_SEGWIT_VERSION_WARNING);

I'm writing an app that continuously parses lots of transactions (for analysis purposes) This warning is printed every time such output-script is parsed, and it really spams my logs.

Please make it possible to avoid this warning, maybe via an environment variable.
Another reasonable option is to print the warning only after the first time such an output-script is found, and not in following occurrences.

Thanks!

@junderw
Copy link
Member

junderw commented May 14, 2022

A few thoughts:

  1. This will be fixed for segwit v1 addresses in an upcoming release (once we finish taproot support)
  2. That said, console.warn was meant primarily for wallet developers to be sure that they don't show versions they can't guarantee are safe.
  3. However, we have no way programmatically to relay that info back to the program, and the program has no way to tell us "ok, I made my GUI understandable so the end user is not in danger".
  4. Also, we want to respect the BIP and DO NOT THROW on parsing unknown segwit versions.

Perhaps we should add a new set of functions for to/fromOutputScript and deprecate the current ones for removal in the next major version bump?

@junderw
Copy link
Member

junderw commented May 14, 2022

As a temporary solution, though super hackey, the consuming app could do something like:

function wrappedFromOutputScript(script, network) {
  const oldWarn = console.warn
  console.warn = () => {}
  const result = fromOutputScript(script, network)
  console.warn = oldWarn
  return result
}

@woofbotapp
Copy link
Author

As a temporary solution, though super hackey, the consuming app could do something like:

function wrappedFromOutputScript(script, network) {
  const oldWarn = console.warn
  console.warn = () => {}
  const result = fromOutputScript(script, network)
  console.warn = oldWarn
  return result
}

giphy

@PatrickGeyer
Copy link

Is there an ETA on this at all?

@motorina0
Copy link
Member

Is there an ETA on this at all?

Please help review this PR #1742, and the rest will follow 🎵

@pedrobranco
Copy link

This also happens when parsing some Litecoin transactions.
Maybe adding an optional argument in fromOutputScript to disable these warnings?

@junderw junderw linked a pull request Apr 4, 2024 that will close this issue
@junderw
Copy link
Member

junderw commented Apr 4, 2024

I guess we can just do it once. See PR.

@fabiobaiao
Copy link

Can this be merged and published, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants