Ability to block and list blocks

This commit is contained in:
Netscape Navigator 2019-11-26 19:55:52 -06:00
parent 0c160251ef
commit 4b33674771
2 changed files with 9 additions and 7 deletions

BIN
db.pigeon

Binary file not shown.

View File

@ -78,10 +78,12 @@ module Pigeon
end
def block_peer(identity)
# remove_peer(identity)
# path = KeyPair.strip_headers(identity)
# FileUtils.touch(File.join(block_dir, path))
# identity
remove_peer(identity)
store.transaction do
store[BLCK_NS] ||= Set.new
store[BLCK_NS].add(identity)
end
identity
end
def all_peers
@ -91,9 +93,9 @@ module Pigeon
end
def all_blocks
Dir[File.join(block_dir, "*")]
.map { |x| File.split(x).last }
.map { |x| KeyPair.add_headers(x) }
store.transaction(true) do
(store[BLCK_NS] || Set.new).to_a
end
end
private