mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
test: fix constructor of msg_tx
In python, if the default value is a mutable object (here: a class)
its shared over all instances, so that one instance being changed
would affect others to be changed as well.
This was likely the source of various intermittent bugs in the
functional tests.
Github-Pull: #30552
Rebased-From: ec5e294e4b
This commit is contained in:
parent
0cbdc6b380
commit
500bba0561
1 changed files with 5 additions and 2 deletions
|
@ -1293,8 +1293,11 @@ class msg_tx:
|
|||
__slots__ = ("tx",)
|
||||
msgtype = b"tx"
|
||||
|
||||
def __init__(self, tx=CTransaction()):
|
||||
self.tx = tx
|
||||
def __init__(self, tx=None):
|
||||
if tx is None:
|
||||
self.tx = CTransaction()
|
||||
else:
|
||||
self.tx = tx
|
||||
|
||||
def deserialize(self, f):
|
||||
self.tx.deserialize(f)
|
||||
|
|
Loading…
Reference in a new issue