Never save same message twice

This commit is contained in:
Netscape Navigator 2020-04-01 07:38:32 -05:00
parent e84ee564e7
commit e79e0aedf3
2 changed files with 7 additions and 1 deletions

View File

@ -31,6 +31,7 @@ module Pigeon
def save_message(msg)
write do
return msg if store[MESG_NS][msg.multihash]
insert_and_update_index(msg)
msg
end

View File

@ -4,8 +4,13 @@ RSpec.describe Pigeon::Storage do
LOGO_BLOB = File.read("./logo.png")
IDS = %w(@_TlC2z3FT4fimecC4eytrBhOwhLUZsVBZEZriBO9cWs=.ed25519
@28FyT7evjcYrrwngr8G2V1HZ0ODK0VPsFctDEZwfZJc=.ed25519)
let(:s) do
before(:each) do
Pigeon::Storage.reset
Pigeon::LocalIdentity.reset
end
let(:s) do
Pigeon::Storage.current
end