mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge bitcoin/bitcoin#30552: test: fix constructor of msg_tx
ec5e294e4b830766dcc4a80add0613d3705c1794 test: fix constructor of msg_tx (Martin Zumsande) Pull request description: In python, if the default value is a mutable object (here: a class) it is shared over all instances, so that one instance being changed would affect others to be changed as well. This was the source of #30543, and possibly various other intermittent bugs in the functional tests, see https://github.com/bitcoin/bitcoin/issues/29621#issuecomment-1999298224. Fixes #30543 Fixes #29621 Fixes #25128 ACKs for top commit: sipa: utACK ec5e294e4b830766dcc4a80add0613d3705c1794. I believe some linters even warn about doing this. maflcko: ACK ec5e294e4b830766dcc4a80add0613d3705c1794 vasild: ACK ec5e294e4b830766dcc4a80add0613d3705c1794 ❤️ theStack: ACK ec5e294e4b830766dcc4a80add0613d3705c1794 Tree-SHA512: a6204fb1a326de3f9aa965f345fd658f6a4dcf78731db25cc905ff6eb8d4eeb65d14cc316305eebd89387aec8748c57c3a4f4ca62408f8e5ee53f535b88b1411
This commit is contained in:
parent
df3c2392ca
commit
e4e5605ef8
@ -1724,8 +1724,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 New Issue
Block a user