! transactions fixes

This commit is contained in:
Taegus
2018-12-25 12:09:14 +01:00
parent 82e988a723
commit a32b746e4f
2 changed files with 8 additions and 2 deletions

View File

@@ -9,10 +9,16 @@ db.loadDatabase(function (err) {
// Now commands will be executed
});
// index the block field
db.ensureIndex({ fieldName: 'block' }, function (err) {
// If there was an error, err is not null
});
// index the txhash field
db.ensureIndex({ fieldName: 'txhash', unique: true }, function (err) {
// If there was an error, err is not null
});
ipcMain.on('storeTransaction', (event, arg) => {
db.update({ txhash: arg.txhash }, arg, { upsert: true }, function (err, numReplaced, upsert) {
// do nothing for now

View File

@@ -137,7 +137,7 @@ class Transactions {
{
"targets": 2,
"render": function ( data, type, row ) {
return moment(data).format("MMM Do YYYY HH:mm:ss");
return moment(data, "YYYY-MM-DD HH:mm:ss").format("MMM Do YYYY HH:mm:ss");
}
},
{
@@ -198,7 +198,7 @@ $(document).on("onSyncInterval", function() {
block: element.blockNumber.toString(),
txhash: element.hash.toLowerCase(),
fromaddr: element.from.toLowerCase(),
timestamp: moment().format('YYYY-MM-DD HH:mm:ss'),
timestamp: moment.unix(data.timestamp).format('YYYY-MM-DD HH:mm:ss'),
toaddr: element.to.toLowerCase(),
value: Number(element.value).toExponential(5).toString().replace('+','')
}