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

Allow prematureWitness flag #528

Closed
alex-miller-0 opened this issue Jul 11, 2018 · 8 comments
Closed

Allow prematureWitness flag #528

alex-miller-0 opened this issue Jul 11, 2018 · 8 comments
Labels
enhancement Improving a current feature

Comments

@alex-miller-0
Copy link

I am using bcoin for a local regtest network and want to use segwit. Looks like this is blocked based on the block number of my chain by a prematureWitness flag.

Unfortunately, there does not appear to be a way to set this configuation in my bcoin.conf file, as all the Mempool options are transcribed here and prematureWitness isn't on them.

It would be nice if I could set this flag to true in a conf file.

@alex-miller-0 alex-miller-0 changed the title Allow prematureSegwit flag Allow prematureWitness flag Jul 11, 2018
@jonajosejg
Copy link

Hey man this might be irrelevant but there's a witness option in the wallet which will enable segwit in regtest mode. If that proves to not solve the segwit activation i can write a gist that'll enable segwit by default in regtest mode.

@bucko13
Copy link
Contributor

bucko13 commented Jul 11, 2018

This is a legacy from core which required 432 blocks to be mined before segwit activation on regtest (good article that mentions it here). Seems like it would be a good idea to either add this to configs though and possibly turn it on by default.

@alex-miller-0
Copy link
Author

So the way I fixed this was:

  1. Allowing premature-witness flag to be parsed (prematureWitness: this.config.bool('premature-witness') in lib/node/fullnode.js
  2. Hardcoding the VERIFY_WITNESS flag to 1 in lib/script/common.js

Although this works, it seems pretty hacky and I'm not sure what the ramifications are of especially the second point.

My use case is simply broadcasting segwit transactions (pre-signed and built to hex); is there a way to do this without forking the codebase?

@bucko13
Copy link
Contributor

bucko13 commented Jul 13, 2018

Hey @alex-miller-0,
If you're on testnet or mainnet, and your wallet has been initialized with witness: true then you're good to go. If you're on regtest, once you've mined 432 blocks (which will happen in milliseconds on a new regtest chain), it will work the same way.

@alex-miller-0
Copy link
Author

I'm actually building a very lightweight signing mechanism and can't use the bcoin wallet class. I'm only using bcoin to broadcast raw transactions via the RPC API.

@bucko13
Copy link
Contributor

bucko13 commented Jul 13, 2018

That's fine. I was just mentioning those as the two pre-requisites. If you're on regtest and the network has mined 432 blocks it should be accepted by the mempool. I've tested this on my own regtest setups and it works 👍

@pinheadmz
Copy link
Member

addressed in #580

@bucko13 bucko13 closed this as completed Oct 30, 2018
@bucko13 bucko13 reopened this Oct 30, 2018
@pinheadmz pinheadmz added enhancement Improving a current feature has PR Issue is addressed with a pull request labels Jan 21, 2019
@pinheadmz
Copy link
Member

@alex-miller-0 Check out recent merge of #676
In regtest, now SegWit is activated at genesis.

@braydonf braydonf closed this as completed Feb 6, 2019
@braydonf braydonf removed the has PR Issue is addressed with a pull request label May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving a current feature
Projects
None yet
Development

No branches or pull requests

5 participants