-
Notifications
You must be signed in to change notification settings - Fork 648
Expand file tree
/
Copy pathtest_params.py
More file actions
35 lines (28 loc) · 1.29 KB
/
test_params.py
File metadata and controls
35 lines (28 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Copyright (C) 2013-2014 The python-bitcoinlib developers
#
# This file is part of python-bitcoinlib.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-bitcoinlib, including this file, may be copied, modified,
# propagated, or distributed except according to the terms contained in the
# LICENSE file.
import unittest
import bitcoin
from bitcoin.messages import msg_addr
class Test_params(unittest.TestCase):
def tearDown(self):
bitcoin.SelectParams('mainnet')
def test_mainnet_magic_byte(self):
bitcoin.SelectParams('mainnet')
self.assertEquals(bitcoin.MainParams().MESSAGE_START, msg_addr().to_bytes()[0:4])
def test_testnet_magic_byte(self):
bitcoin.SelectParams('testnet')
self.assertEquals(bitcoin.TestNetParams().MESSAGE_START, msg_addr().to_bytes()[0:4])
def test_mainnet_params_magic_byte(self):
bitcoin.SelectParams('testnet')
self.assertEquals(bitcoin.MainParams().MESSAGE_START, msg_addr().to_bytes(params=bitcoin.MainParams())[0:4])
def test_testnet_params_magic_byte(self):
bitcoin.SelectParams('mainnet')
self.assertEquals(bitcoin.TestNetParams().MESSAGE_START, msg_addr().to_bytes(params=bitcoin.TestNetParams())[0:4])