Adding a blockLocker to the system.

This commit is contained in:
Alexander Blair
2017-02-13 11:26:30 -08:00
parent 2d97826020
commit 0efcd22a8a
2 changed files with 30 additions and 0 deletions
+11
View File
@@ -324,6 +324,17 @@ function Database(){
txn.commit();
};
this.lockBlock = function(blockId){
let txn = this.env.beginTxn();
let blockProto = txn.getBinary(this.blockDB, blockId);
if (blockProto !== null){
let blockData = global.protos.Block.decode(blockProto);
blockData['unlocked'] = false;
txn.putBinary(this.blockDB, blockId, global.protos.Block.encode(blockData));
}
txn.commit();
};
this.getCache = function(cacheKey){
debug("Getting Key: "+cacheKey);
try {