Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then((res) => {
Log.getIpfsHash(this._ipfs, this._logs[channel]).then((listHash) => {
this.lastWrite = listHash;
Cache.set(channel, listHash);
// Cache the payload
let op = JSON.parse(JSON.stringify(res.op));
Object.assign(op, { hash: res.node.payload });
if(op.key === null) Object.assign(op, { key: res.node.payload });
this._cached.push(op);
this.events[channel].emit('write', channel, listHash);
resolve(res.node.payload);
})
}).catch(reject);
});
.then(() => Log.getIpfsHash(this._ipfs, this))
.then((hash) => Cache.set(this.name, hash))
.then(() => Log.getIpfsHash(this._ipfs, this._oplog))
.then((hash) => logHash = hash)