Skip to content

Commit

Permalink
added position
Browse files Browse the repository at this point in the history
deterministic eos_keys
  • Loading branch information
dskvr committed May 21, 2018
1 parent 7771776 commit 690b777
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions bin/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# https://github.com/sequelpro/sequelpro
#
# Host: 127.0.0.1 (MySQL 5.6.37)
# Database: eos_snapshot
# Generation Time: 2018-05-19 11:47:13 +0000
# Database: eos_snapshot_refactor
# Generation Time: 2018-05-21 10:27:33 +0000
# ************************************************************


Expand Down Expand Up @@ -99,6 +99,7 @@ DROP TABLE IF EXISTS `registrations`;
CREATE TABLE `registrations` (
`uuid` varchar(256) NOT NULL,
`tx_hash` varchar(256) NOT NULL DEFAULT '',
`position` int(11) NOT NULL,
`block_number` int(255) NOT NULL,
`address` varchar(256) NOT NULL DEFAULT '',
`eos_key` varchar(256) DEFAULT NULL,
Expand Down
1 change: 1 addition & 0 deletions tools/snapshot/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ db.Registrations = mysql.define('registration', {
primaryKey: true
},
tx_hash: Sequelize.STRING(256),
position: Sequelize.INTEGER,
block_number: Sequelize.STRING(256),
address: Sequelize.STRING(256),
eos_key: Sequelize.STRING(256)
Expand Down
5 changes: 4 additions & 1 deletion tools/snapshot/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ query.last_register = (address, begin, end, callback) => {
}
]
},
order: [['block_number', 'DESC']],
order: [
['block_number', 'DESC'],
['position', 'DESC']
],
limit: 1
})
.then( results => callback( results.length ? results[0].dataValues.eos_key : null ) )
Expand Down
1 change: 1 addition & 0 deletions tools/snapshot/tasks/sync/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ module.exports = ( state, complete ) => {
return {
uuid: generate_uuid(registration),
tx_hash: registration.transactionHash,
position: registration.transactionIndex,
block_number: registration.blockNumber,
address: registration.returnValues.user.toLowerCase(),
eos_key: encodeURIComponent(registration.returnValues.key)
Expand Down

0 comments on commit 690b777

Please sign in to comment.