feat: store message size
This commit is contained in:
parent
f331a19d75
commit
c488f5d5e0
4 changed files with 12 additions and 5 deletions
|
|
@ -116,6 +116,11 @@ class NostrEvent(BaseModel):
|
|||
id = hashlib.sha256(data.encode()).hexdigest()
|
||||
return id
|
||||
|
||||
@property
|
||||
def size_bytes(self) -> int:
|
||||
s = json.dumps(dict(self), separators=(",", ":"), ensure_ascii=False)
|
||||
return len(s.encode())
|
||||
|
||||
def is_replaceable_event(self) -> bool:
|
||||
return self.kind in [0, 3]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue