intantiate ephemeral channels with 34 hex characters

This commit is contained in:
ansuz
2019-01-14 15:27:09 +01:00
parent 6963f00a57
commit 9105a89eab
2 changed files with 8 additions and 4 deletions

View File

@@ -197,7 +197,10 @@ define([
};
funcs.openCursorChannel = function (saveChanges) {
var md = JSON.parse(JSON.stringify(ctx.metadataMgr.getMetadata()));
var channel = md.cursor || Hash.createChannelId();
var channel = md.cursor;
if (typeof(channel) !== 'string' || channel.length !== Hash.ephemeralChannelLength) {
channel = Hash.createChannelId(true); // true indicates that it's an ephemeral channel
}
if (!md.cursor) {
md.cursor = channel;
ctx.metadataMgr.updateMetadata(md);