def test_broadcast_cross_shard_transactions_to_neighbor_only(self):
    ' Test the broadcast is only done to the neighbors '
    id1 = Identity.create_random_identity()
    acc1 = Address.create_from_identity(id1, full_shard_key=0)
    with ClusterContext(1, acc1, shard_size=64, num_slaves=4) as clusters:
        master = clusters[0].master
        root_block = call_async(master.get_next_block_to_mine(Address.create_empty_account(), branch_value=None))
        call_async(master.add_root_block(root_block))
        b1 = clusters[0].get_shard_state(64).create_block_to_mine(address=acc1)
        self.assertTrue(call_async(master.add_raw_minor_block(b1.header.branch, b1.serialize())))
        neighbor_shards = [(2 ** i) for i in range(6)]
        for shard_id in range(64):
            xshard_tx_list = clusters[0].get_shard_state((64 | shard_id)).db.get_minor_block_xshard_tx_list(b1.header.get_hash())
            if (shard_id in neighbor_shards):
                self.assertIsNotNone(xshard_tx_list)
            else:
                self.assertIsNone(xshard_tx_list)
Test the broadcast is only done to the neighbors
def test_broadcast_cross_shard_transactions_to_neighbor_only(self):
    '  '
    id1 = Identity.create_random_identity()
    acc1 = Address.create_from_identity(id1, full_shard_key=0)
    with ClusterContext(1, acc1, shard_size=64, num_slaves=4) as clusters:
        master = clusters[0].master
        root_block = call_async(master.get_next_block_to_mine(Address.create_empty_account(), branch_value=None))
        call_async(master.add_root_block(root_block))
        b1 = clusters[0].get_shard_state(64).create_block_to_mine(address=acc1)
        self.assertTrue(call_async(master.add_raw_minor_block(b1.header.branch, b1.serialize())))
        neighbor_shards = [(2 ** i) for i in range(6)]
        for shard_id in range(64):
            xshard_tx_list = clusters[0].get_shard_state((64 | shard_id)).db.get_minor_block_xshard_tx_list(b1.header.get_hash())
            if (shard_id in neighbor_shards):
                self.assertIsNotNone(xshard_tx_list)
            else:
                self.assertIsNone(xshard_tx_list)