Bitcore is making invalid addresses

(new bitcore.PrivateKey()).toAddress(bitcore.Networks.get(‘mrs’)).toString()

bitcore.Address.isValid(“MMhdMVPgfURmEgPQbekKY5NJJayhPXNN1C”, bitcore.Networks.get(‘mrs’))

(new bitcore.PrivateKey()).toAddress(bitcore.Networks.get(‘mrs’)).toString()

bitcore.Address.isValid(“M7wL9sP1yekuYKNDxxQqUZWQUxG4JjZj8K”, bitcore.Networks.get(‘mrs’))

The ‘mrs’ network is defined as having privatekey=178 and pubkeyhash=50

By the way, the addresses generated appear to be valid, it’s just the isValid method that is incorrectly reporting that the address in invalid.


bitcore.Address.getValidationError(“M7wL9sP1yekuYKNDxxQqUZWQUxG4JjZj8K”, bitcore.Networks.get(‘mrs’))
TypeError: Address has mismatched network type.

then update the post title accordingly

I figured out the problem. The reason why MRS wasn’t working is because I have another network registered (XMY) which uses the same address byte (50). I guess you can’t use networks with the same address byte simultaneously… Is there a workaround?

Here is a demonstration of the error:

see how #76 are all invalid?

I figured out a fix:

This solves the issue I’m having, but a shitload of tests now fail. Does anybody who knows a lot about bitcore’s internals want to help me get all tests passing?