mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-10-26 05:48:34 +01:00
Moving share validation into remoteShare before it ever gets to our internal processing DB loop.
This commit is contained in:
+3
-1
@@ -188,14 +188,15 @@ function Database(){
|
||||
};
|
||||
let shares = {}; // Shares keyed by blockID
|
||||
let shareCount = 0;
|
||||
debug(shareObject.length + ' shares to process');
|
||||
shareObject.forEach(function(data){
|
||||
//Data is the share object at this point.
|
||||
let share = global.protos.Share.decode(data);
|
||||
shareCount += 1;
|
||||
if (!shares.hasOwnProperty(share.blockHeight)){
|
||||
shares[share.blockHeight] = [];
|
||||
}
|
||||
shares[share.blockHeight].push(data);
|
||||
shareCount += 1;
|
||||
let minerID = share.paymentAddress;
|
||||
if (typeof(share.paymentID) !== 'undefined' && share.paymentID.length > 10) {
|
||||
minerID = minerID + '.' + share.paymentID;
|
||||
@@ -276,6 +277,7 @@ function Database(){
|
||||
sharesSeen += 1;
|
||||
txn.putBinary(global.database.shareDB, key, share);
|
||||
if (Object.keys(shares).length === blocksSeen && sharesSeen === shares[key].length){
|
||||
debug('Made it to where I can do the insert');
|
||||
txn.commit();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user