From 5e7ea80809d43d0aba79c38a95ceda4a398581fe Mon Sep 17 00:00:00 2001 From: Ethan Heilman Date: Wed, 31 Dec 2014 18:01:31 -0500 Subject: [PATCH] Fixing bug where to_bytes clobbers testnet params. [ yapified by gitreformat (github/ghtdak) on Mon Nov 30 21:11:38 2015 ] --- bitcoin/messages.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bitcoin/messages.py b/bitcoin/messages.py index 456c1fcc..3e33f58b 100644 --- a/bitcoin/messages.py +++ b/bitcoin/messages.py @@ -33,7 +33,7 @@ from bitcoin.core import * from bitcoin.core.serialize import * from bitcoin.net import * -from bitcoin import MainParams +import bitcoin MSG_TX = 1 MSG_BLOCK = 2 @@ -52,11 +52,11 @@ def msg_ser(self, f): def msg_deser(cls, f, protover=PROTO_VERSION): raise NotImplementedError - def to_bytes(self, params=MainParams()): + def to_bytes(self): f = _BytesIO() self.msg_ser(f) body = f.getvalue() - res = params.MESSAGE_START + res = bitcoin.params.MESSAGE_START res += self.command res += b"\x00" * (12 - len(self.command)) res += struct.pack(b"