mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
Merge bitcoin/bitcoin#30552: test: fix constructor of msg_tx
ec5e294e4b
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: utACKec5e294e4b
. I believe some linters even warn about doing this. maflcko: ACKec5e294e4b
vasild: ACKec5e294e4b
❤️ theStack: ACKec5e294e4b
Tree-SHA512: a6204fb1a326de3f9aa965f345fd658f6a4dcf78731db25cc905ff6eb8d4eeb65d14cc316305eebd89387aec8748c57c3a4f4ca62408f8e5ee53f535b88b1411
This commit is contained in:
commit
be969292db
1 changed files with 5 additions and 2 deletions
|
@ -1294,8 +1294,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…
Add table
Reference in a new issue