diff --git a/src/index.ts b/src/index.ts index 46fb16e..943360b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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; }