Browse Source

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

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

2
models/address.js

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

36
public/stylesheets/style.css

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

12
views/block.jade

@ -5,6 +5,18 @@ block content @@ -5,6 +5,18 @@ block content
table
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')
-continue
tr

9
views/layout.jade

@ -4,16 +4,17 @@ html @@ -4,16 +4,17 @@ html
title GOSTcoin blockchain explorer
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='shortcut icon', href='/favicon.ico')
meta(name="viewport", content="width=device-width")
body
div.page-wrapper
div.page
div.header
h1
div.logo
a(href='/')
img(src='/images/gostcoin-b.png')
span GOSTcoin blockchain explorer
h1
a(href='/') GOSTcoin blockchain explorer
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="submit", value=">>")
div.content

Loading…
Cancel
Save