Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: lfm on August 03, 2011, 07:48:38 AM



Title: testnet accepts main net addresses
Post by: lfm on August 03, 2011, 07:48:38 AM
I find it is inexplicable and inconvenient to an extreme that the client running testnet accepts mainnet addresses. Could we please fix this. It is just a one line fix.

in base58.h: change line:
     return (nVersion <= ADDRESSVERSION);
to:
     return (nVersion == ADDRESSVERSION);

I don't see any practical reason for it to be the way it is. It is only an historical accident that it was named a version byte. It is not a version byte and has never been a version byte. If some day we do need/want to use it as a version byte we will need to rewrite the code in question anyway as I see it.

Meanwhile it is used as a net id byte for addresses and I think it is a mistake to use addresses from another net and the net id byte can be used to detect when you are trying to use an address with the wrong net and prevent your mistake.

Thank you.


Title: Re: testnet accepts main net addresses
Post by: wumpus on August 03, 2011, 08:05:40 AM
Yes, the current way is not optimal.

There have been already some proposals on the mailing list for new version byte layouts, might be an idea to adopt one of those eventually.


Title: Re: testnet accepts main net addresses
Post by: jackjack on August 03, 2011, 03:44:32 PM
It is only an historical accident that it was named a version byte
No: https://bitcointalk.org/index.php?topic=26808.msg401835#msg401835
If you sent coins to the wrong network, just use pywallet