Commit a55b0d52 authored by Eriksson Monteiro's avatar Eriksson Monteiro

update millix node

parent 01828f2c
...@@ -44,6 +44,22 @@ class _IBHgAmydZbmTUAe8 extends Endpoint { ...@@ -44,6 +44,22 @@ class _IBHgAmydZbmTUAe8 extends Endpoint {
})); }));
} }
const parentSet = {};
_.each(data, row => parentSet[row.transaction_id_parent] = null);
const parentTransactionListID = Object.keys(parentSet);
return database.applyShards((shardID) => {
return database.getRepository('transaction', shardID)
.listTransactions({'transaction_id_in': parentTransactionListID});
}).then(parentTransactionList => {
_.each(parentTransactionList, parentTransaction => {
if(!parentSet[parentTransaction.transaction_id]) {
parentSet[parentTransaction.transaction_id] = parentTransaction.shard_id;
}
});
_.each(data, transaction => transaction.shard_id_parent = parentSet[transaction.transaction_id_parent] || null);
return data;
});
}).then(data => {
const normalization = database.getRepository('normalization'); const normalization = database.getRepository('normalization');
const transaction = {}; const transaction = {};
_.extend(transaction, _.pick(data[0], 'transaction_id', 'shard_id', 'transaction_date', 'node_id_origin', 'node_id_proxy', 'version', 'payload_hash', 'stable_date', 'is_stable', 'parent_date', 'is_parent', 'timeout_date', 'is_timeout', 'status', 'create_date')); _.extend(transaction, _.pick(data[0], 'transaction_id', 'shard_id', 'transaction_date', 'node_id_origin', 'node_id_proxy', 'version', 'payload_hash', 'stable_date', 'is_stable', 'parent_date', 'is_parent', 'timeout_date', 'is_timeout', 'status', 'create_date'));
...@@ -51,11 +67,11 @@ class _IBHgAmydZbmTUAe8 extends Endpoint { ...@@ -51,11 +67,11 @@ class _IBHgAmydZbmTUAe8 extends Endpoint {
transaction['transaction_date'] = Math.floor(transaction.transaction_date.getTime() / 1000); transaction['transaction_date'] = Math.floor(transaction.transaction_date.getTime() / 1000);
} }
const signatures = new Set(); const signatures = new Set();
const inputs = new Set(); const inputs = new Set();
const outputs = new Set(); const outputs = new Set();
const outputAttributes = new Set(); const outputAttributes = new Set();
const parents = new Set(); const parents = new Set();
transaction['transaction_signature_list'] = []; transaction['transaction_signature_list'] = [];
transaction['transaction_input_list'] = []; transaction['transaction_input_list'] = [];
...@@ -119,7 +135,7 @@ class _IBHgAmydZbmTUAe8 extends Endpoint { ...@@ -119,7 +135,7 @@ class _IBHgAmydZbmTUAe8 extends Endpoint {
if (row.transaction_id_parent && !parents.has(row.transaction_id_parent)) { if (row.transaction_id_parent && !parents.has(row.transaction_id_parent)) {
parents.add(row.transaction_id_parent); parents.add(row.transaction_id_parent);
transaction['transaction_parent_list'].push(_.mapKeys(_.pick(row, 'transaction_id_parent', 'transaction_id_child', 'transaction_parent_status', 'transaction_parent_create_date'), keyMapFunction)); transaction['transaction_parent_list'].push(_.mapKeys(_.pick(row, 'transaction_id_parent', 'shard_id_parent', 'transaction_id_child', 'shard_id_child', 'transaction_parent_status', 'transaction_parent_create_date'), keyMapFunction));
} }
}); });
......
...@@ -772,7 +772,7 @@ export const DATABASE_ENGINE = 'sqlite'; ...@@ -772,7 +772,7 @@ export const DATABASE_ENGINE = 'sqlite';
export const DATABASE_CONNECTION = {}; export const DATABASE_CONNECTION = {};
export const MILLIX_CIRCULATION = 9e15; export const MILLIX_CIRCULATION = 9e15;
export const NODE_MILLIX_BUILD_DATE = 1640009160; export const NODE_MILLIX_BUILD_DATE = 1640009160;
export const NODE_MILLIX_VERSION = '1.14.3-tangled'; export const NODE_MILLIX_VERSION = '1.14.4-tangled';
export const DATA_BASE_DIR_MAIN_NETWORK = './millix-tangled'; export const DATA_BASE_DIR_MAIN_NETWORK = './millix-tangled';
export const DATA_BASE_DIR_TEST_NETWORK = './millix-tangled'; export const DATA_BASE_DIR_TEST_NETWORK = './millix-tangled';
let DATA_BASE_DIR = MODE_TEST_NETWORK ? DATA_BASE_DIR_TEST_NETWORK : DATA_BASE_DIR_MAIN_NETWORK; let DATA_BASE_DIR = MODE_TEST_NETWORK ? DATA_BASE_DIR_TEST_NETWORK : DATA_BASE_DIR_MAIN_NETWORK;
......
...@@ -45,7 +45,8 @@ export class Database { ...@@ -45,7 +45,8 @@ export class Database {
if (where) { if (where) {
_.each(_.keys(where), key => { _.each(_.keys(where), key => {
if (where[key] === undefined || if (where[key] === undefined ||
((key.endsWith('_begin') || key.endsWith('_min') || key.endsWith('_end') || key.endsWith('_max')) && !where[key])) { ((key.endsWith('_begin') || key.endsWith('_min') || key.endsWith('_end') || key.endsWith('_max')) && !where[key]) ||
(key.endsWith('_in') && !(where[key] instanceof Array))) {
return; return;
} }
...@@ -62,6 +63,13 @@ export class Database { ...@@ -62,6 +63,13 @@ export class Database {
else if (key.endsWith('_end') || key.endsWith('_max')) { else if (key.endsWith('_end') || key.endsWith('_max')) {
sql += `${key.substring(0, key.lastIndexOf('_'))} <= ?`; sql += `${key.substring(0, key.lastIndexOf('_'))} <= ?`;
} }
else if (key.endsWith('_in')) {
sql += `${key.substring(0, key.lastIndexOf('_'))} IN (${where[key].map(() => '?').join(',')})`;
for(let parameter of where[key]) {
parameters.push(parameter);
}
return;
}
else { else {
sql += `${key}= ?`; sql += `${key}= ?`;
} }
......
...@@ -126,6 +126,6 @@ db.initialize() ...@@ -126,6 +126,6 @@ db.initialize()
}); });
} }
}); });
//millix v1.14.3-tangled //millix v1.14.4-tangled
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment