! transactions fixes
This commit is contained in:
@@ -9,9 +9,15 @@ db.loadDatabase(function (err) {
|
|||||||
// Now commands will be executed
|
// Now commands will be executed
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// index the block field
|
||||||
db.ensureIndex({ fieldName: 'block' }, function (err) {
|
db.ensureIndex({ fieldName: 'block' }, function (err) {
|
||||||
// If there was an error, err is not null
|
// 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) => {
|
ipcMain.on('storeTransaction', (event, arg) => {
|
||||||
db.update({ txhash: arg.txhash }, arg, { upsert: true }, function (err, numReplaced, upsert) {
|
db.update({ txhash: arg.txhash }, arg, { upsert: true }, function (err, numReplaced, upsert) {
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ class Transactions {
|
|||||||
{
|
{
|
||||||
"targets": 2,
|
"targets": 2,
|
||||||
"render": function ( data, type, row ) {
|
"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(),
|
block: element.blockNumber.toString(),
|
||||||
txhash: element.hash.toLowerCase(),
|
txhash: element.hash.toLowerCase(),
|
||||||
fromaddr: element.from.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(),
|
toaddr: element.to.toLowerCase(),
|
||||||
value: Number(element.value).toExponential(5).toString().replace('+','')
|
value: Number(element.value).toExponential(5).toString().replace('+','')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user