From 5310b34d390108fae58e61f91be54f6244f8aa18 Mon Sep 17 00:00:00 2001 From: Hanyun Xu Date: Mon, 28 Oct 2019 16:50:07 -0700 Subject: [PATCH] Filter out minor block headers with larger create time (#780) * Filter out minor block headers with larger create time * remove invalid minor block header * remove empty line * remove invalid minor blocks when create bloack to mine * remove empty line --- quarkchain/cluster/root_state.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/quarkchain/cluster/root_state.py b/quarkchain/cluster/root_state.py index 789083dcc..139f85c89 100644 --- a/quarkchain/cluster/root_state.py +++ b/quarkchain/cluster/root_state.py @@ -337,6 +337,9 @@ def create_block_to_mine(self, m_header_list, address=None, create_time=None): block = self.tip.create_block_to_append( create_time=create_time, address=address, difficulty=difficulty ) + + # Filter out minor blocks with greater create_time + m_header_list = [h for h in m_header_list if h.create_time <= create_time] block.minor_block_header_list = m_header_list coinbase_tokens = self._calculate_root_block_coinbase(