petertodd/python-bitcoinlib — pull request #38 by EthanHeilman (2014-12-31 23:03:58+00:00)
Title: Fixing bug where to_bytes clobbers testnet params.

To replicate the bug run the following commands in python console:

>>> import bitcoin
>>> from bitcoin.messages import msg_addr
>>> bitcoin.SelectParams('testnet')
>>> msg_addr().to_bytes()[0]
'\xf9'

Notice that the magic byte is set for main, not testnet.

After my change:

>>> import bitcoin
>>> from bitcoin.messages import msg_addr
>>> bitcoin.SelectParams('testnet')
>>> msg_addr().to_bytes()[0]
'\x0b'

Notice that the magic byte(s) are correct for testnet.

Happy new years. =)