Browse Source

Address length to 35, sync blockchain nextblockhash update fix, restyling

stuff
xcps 7 years ago
parent
commit
0a86fb43a4
  1. 11
      bin/syncBlockchain.babel.js
  2. 2
      models/address.js
  3. 36
      public/stylesheets/style.css
  4. 12
      views/block.jade
  5. 9
      views/layout.jade

11
bin/syncBlockchain.babel.js

@ -102,11 +102,18 @@ async function syncNextBlock(syncedHeight) {
const block = JSON.parse(res_block)['result']; const block = JSON.parse(res_block)['result'];
block.time = new Date(block.time * 1000); block.time = new Date(block.time * 1000);
await models.Block.create(block); await models.Block.create(block);
// console.log('block:', block);
for (var i = 0; i < block.tx.length; i++) { for (var i = 0; i < block.tx.length; i++) {
await saveTransaction(block.tx[i], block.height); await saveTransaction(block.tx[i], block.height);
} }
if (block.height > 1) {
await models.Block.update({
nextblockhash: block.hash
},{
where: {
hash: block.previousblockhash
}
});
}
return height; return height;
} }

2
models/address.js

@ -2,7 +2,7 @@
module.exports = (sequelize, DataTypes) => { module.exports = (sequelize, DataTypes) => {
const Address = sequelize.define('Address', { const Address = sequelize.define('Address', {
address: DataTypes.STRING(34), address: DataTypes.STRING(35),
}, { }, {
timestamps: false, timestamps: false,
indexes: [{ indexes: [{

36
public/stylesheets/style.css

@ -6,14 +6,7 @@ body {
font: 16px monospace; font: 16px monospace;
} }
.page-wrapper { .page {
display: flex;
justify-content: center;
}
.page.absolute {
display: flex;
flex-direction: column;
} }
table td { table td {
@ -28,43 +21,44 @@ a:hover {
color: #bf5c5f; color: #bf5c5f;
} }
.header {
overflow: hidden;
}
.header h1 a { .header h1 a {
color: black; color: black;
text-decoration: none; text-decoration: none;
align: center; align: center;
outline: none; outline: none;
} }
.header .logo {
.header h1 a img:hover { float: left;
}
.header .logo a img:hover {
filter: brightness(1.25); filter: brightness(1.25);
} }
.header h1 a img { .header .logo a img {
height: 2em; height: 84px;
position: relative; position: relative;
margin-right: .5em; margin-right: .5em;
} }
.header form input[type="submit"] { form.search input[type="submit"] {
padding: .2em .7em; padding: .2em .7em;
} }
@-moz-document url-prefix() { @-moz-document url-prefix() {
.header form input[type="submit"] { form.search input[type="submit"] {
padding: .15em .7em; padding: .15em .7em;
} }
} }
.header form input[type="text"] { form.search input[type="text"] {
padding: .2em; padding: .2em;
} }
.header h1 a span { .header h1 a:hover {
position: relative;
top: -0.5em;
}
.header h1 a span:hover {
border-bottom: 3px solid; border-bottom: 3px solid;
border-bottom-color: #CF7F7F; border-bottom-color: #CF7F7F;
} }

12
views/block.jade

@ -5,6 +5,18 @@ block content
table table
each key in Object.keys(block.dataValues) each key in Object.keys(block.dataValues)
if (key === 'nextblockhash')
tr
td.capitalize #{key}
td
a(href='/block/#{block.nextblockhash}/') #{block.nextblockhash}
-continue
if (key === 'previousblockhash')
tr
td.capitalize #{key}
td
a(href='/block/#{block.previousblockhash}/') #{block.previousblockhash}
-continue
if (key === 'Transactions') if (key === 'Transactions')
-continue -continue
tr tr

9
views/layout.jade

@ -4,16 +4,17 @@ html
title GOSTcoin blockchain explorer title GOSTcoin blockchain explorer
link(rel='stylesheet', href='/stylesheets/style.css') link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='shortcut icon', href='/favicon.ico') link(rel='shortcut icon', href='/favicon.ico')
meta(name="viewport", content="width=device-width")
body body
div.page-wrapper
div.page div.page
div.header div.header
h1 div.logo
a(href='/') a(href='/')
img(src='/images/gostcoin-b.png') img(src='/images/gostcoin-b.png')
span GOSTcoin blockchain explorer h1
a(href='/') GOSTcoin blockchain explorer
div div
form(action="/search/", method="POST") form.search(action="/search/", method="POST")
input(type="text", name="search" placeholder="Search by transaction id, block hash/index or address", size="68") input(type="text", name="search" placeholder="Search by transaction id, block hash/index or address", size="68")
input(type="submit", value=">>") input(type="submit", value=">>")
div.content div.content

Loading…
Cancel
Save