! fixed bug in transaction syncing

This commit is contained in:
Taegus
2018-12-16 19:03:15 +01:00
parent 6cf294ff73
commit 0b807d6e4b
2 changed files with 11 additions and 15 deletions

View File

@@ -14,12 +14,8 @@ db.ensureIndex({ fieldName: 'block' }, function (err) {
});
ipcMain.on('storeTransaction', (event, arg) => {
db.find({ block: arg.block, fromaddr: arg.fromaddr, toaddr: arg.toaddr }, function (err, docs) {
if (docs.length == 0) {
db.insert(arg, function (err, newDoc) {
// do nothing
});
}
db.update({ block: arg.block, fromaddr: arg.fromaddr, toaddr: arg.toaddr }, arg, { upsert: true }, function (err, numReplaced, upsert) {
// do nothing for now
});
});