*Check if we are bootstrapped and queue broadcast in removeItem like with addItem

This commit is contained in:
Derrick Hammer 2022-11-26 17:27:35 -05:00
parent 323530c4bc
commit e53b4eadda
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 13 additions and 5 deletions

View File

@ -136,11 +136,19 @@ export default class DHTCache extends EventEmitter {
this._removeEntity(item);
this._broadcastMessage({
type: Type.REMOVE_ITEM,
data: b4a.from(item, "hex"),
signature: this._signItem(item),
});
const broadcast = () => {
this._broadcastMessage({
type: Type.REMOVE_ITEM,
data: b4a.from(item as string, "hex"),
signature: this._signItem(item),
});
};
if (!this.bootstrapped) {
this.once("bootstrapped", broadcast);
} else {
broadcast();
}
return true;
}