From 24008f31115e4bb1a69a70a5b75b99b844c12e29 Mon Sep 17 00:00:00 2001 From: konez2k <32417933+konez2k@users.noreply.github.com> Date: Sun, 24 Feb 2019 14:29:21 +0100 Subject: [PATCH] [DashElectrumX] prevent size change of self.mns (#739) send_notification adds the retreived collateral to self.mns during masternode.subscribe, this can issue a runtime error because size of self.mns changes during iteration. Reproduce: issue multiple masternode.subscribe (with valid and invalid collaterals) during the same session. --- electrumx/server/session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrumx/server/session.py b/electrumx/server/session.py index 71e54e8..c7ce167 100644 --- a/electrumx/server/session.py +++ b/electrumx/server/session.py @@ -1319,7 +1319,7 @@ class DashElectrumX(ElectrumX): async def notify(self, touched, height_changed): '''Notify the client about changes in masternode list.''' await super().notify(touched, height_changed) - for mn in self.mns: + for mn in self.mns.copy(): status = await self.daemon_request('masternode_list', ['status', mn]) await self.send_notification('masternode.subscribe',