forked from LBRYCommunity/lbry-sdk
fix blocking and filtering
This commit is contained in:
parent
c8b6db4b84
commit
a4be5eb1d8
2 changed files with 9 additions and 3 deletions
|
@ -129,12 +129,12 @@ class LevelDB:
|
||||||
self.blocked_streams = {}
|
self.blocked_streams = {}
|
||||||
self.blocked_channels = {}
|
self.blocked_channels = {}
|
||||||
self.blocking_channel_hashes = {
|
self.blocking_channel_hashes = {
|
||||||
bytes.fromhex(channel_id)[::-1] for channel_id in blocking_channels if channel_id
|
bytes.fromhex(channel_id) for channel_id in blocking_channels if channel_id
|
||||||
}
|
}
|
||||||
self.filtered_streams = {}
|
self.filtered_streams = {}
|
||||||
self.filtered_channels = {}
|
self.filtered_channels = {}
|
||||||
self.filtering_channel_hashes = {
|
self.filtering_channel_hashes = {
|
||||||
bytes.fromhex(channel_id)[::-1] for channel_id in filtering_channels if channel_id
|
bytes.fromhex(channel_id) for channel_id in filtering_channels if channel_id
|
||||||
}
|
}
|
||||||
|
|
||||||
self.tx_counts = None
|
self.tx_counts = None
|
||||||
|
|
|
@ -1537,7 +1537,13 @@ class StreamCommands(ClaimTestCase):
|
||||||
blocking_channel_id = self.get_claim_id(
|
blocking_channel_id = self.get_claim_id(
|
||||||
await self.channel_create('@blocking', '0.1')
|
await self.channel_create('@blocking', '0.1')
|
||||||
)
|
)
|
||||||
self.conductor.spv_node.server.db.blocking_channel_hashes.add(bytes.fromhex(blocking_channel_id))
|
# test setting from env vars and starting from scratch
|
||||||
|
await self.conductor.spv_node.stop(False)
|
||||||
|
await self.conductor.spv_node.start(self.conductor.blockchain_node,
|
||||||
|
extraconf={'BLOCKING_CHANNEL_IDS': blocking_channel_id,
|
||||||
|
'FILTERING_CHANNEL_IDS': filtering_channel_id})
|
||||||
|
await self.daemon.wallet_manager.reset()
|
||||||
|
|
||||||
self.assertEqual(0, len(self.conductor.spv_node.server.db.blocked_streams))
|
self.assertEqual(0, len(self.conductor.spv_node.server.db.blocked_streams))
|
||||||
await self.stream_repost(bad_content_id, 'block1', '0.1', channel_name='@blocking')
|
await self.stream_repost(bad_content_id, 'block1', '0.1', channel_name='@blocking')
|
||||||
self.assertEqual(1, len(self.conductor.spv_node.server.db.blocked_streams))
|
self.assertEqual(1, len(self.conductor.spv_node.server.db.blocked_streams))
|
||||||
|
|
Loading…
Reference in a new issue