getnewaddress generates invalid bech32 addresses in regtest
Expected behavior
When calling getnewaddress and then getaddressinfo on the newly generated address, it should work and return the address info, not an error.
Actual behavior
getaddressinfo returns:
error code: -5
error message:
Invalid address
but only for bech32 addresses and apparently only in regtest chain. Legacy and p2sh-segwit seems to work fine.
To reproduce
Just starts a fresh node in regtest mode, and type the 2 commands.
System information
Tried on 2 different machines with elements 0.18.1.7 and 0.18.1.12:
- Linux sosthene01 5.13.0-28-generic # 31~20.04.1-Ubuntu SMP Wed Jan 19 14:08:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
- Linux sosthene02 5.13.0-27-generic # 29~20.04.1-Ubuntu SMP Fri Jan 14 00:32:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
are you using either liquidregtest or elementsregtest? regtest is reserved for bitcoin
Hi, thanks for the tip ! But I'm a bit confused by a few points nonetheless:
- According to
elementsdhelp, reserved values forchainare:main, test, regtest, liquidv1, liquidv1test. I triedliquidregtest,elementsregtestandliquidv1test, and they seem to be pretty much the same at first glance, what are the uses for those different test chains? - since
regtestis a reserved value forchain, and that iiucmainandtestare simply using elements as a bitcoin node, shouldn't regtest be a bitcoin regtest? I think there's something wrong, I can start a chainregtest, it works, it simply doesn't produce valid bech32 addresses
Did you tried using liquidregtest or elementsregtest? those should produce right address
Yes I did, it solved the problem for me, sorry it wasn't very explicit in my previous answer.
I just wanted to understand more about the different chains that elements is using.
Beside I suspect that's not the expected behaviour when starting elements with chain=regtest and that maybe it should be corrected, even if obviously it would be a low priority bug.
Not an Elements maintainer so not that fond on the reason here (if there is any, or just a bug)
Glad it solved