implement roster.getLastCheckpointHash

This commit is contained in:
ansuz 2019-09-23 11:07:18 +02:00
parent 8326b8b270
commit c8389ba657
1 changed files with 6 additions and 0 deletions

View File

@ -360,6 +360,7 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) {
internal: {
initialized: false,
sinceLastCheckpoint: 0,
lastCheckpointHash: -1
},
};
var roster = {};
@ -395,6 +396,10 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) {
return Util.clone(ref.state);
};
roster.getLastCheckpointHash = function () {
return ref.internal.lastCheckpointHash || -1;
};
var clearPendingCheckpoints = function () {
// clear any pending checkpoints you might have...
if (ref.internal.pendingCheckpointId) {
@ -481,6 +486,7 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) {
events.checkpoint.fire(hash);
// reset the counter for messages since the last checkpoint
ref.internal.sinceLastCheckpoint = 0;
ref.internal.lastCheckpointHash = hash;
} else if (changed) {
events.change.fire();
}