Browse Source

block finder

master
yuriy0803 5 years ago
parent
commit
452062e0de
  1. 5
      storage/redis.go
  2. 14
      www/app/templates/blocks/block.hbs

5
storage/redis.go

@ -63,6 +63,7 @@ type RewardData struct {
} }
type BlockData struct { type BlockData struct {
Finder string `json:"finder"`
Height int64 `json:"height"` Height int64 `json:"height"`
Timestamp int64 `json:"timestamp"` Timestamp int64 `json:"timestamp"`
Difficulty int64 `json:"difficulty"` Difficulty int64 `json:"difficulty"`
@ -101,7 +102,7 @@ func (b *BlockData) RoundKey() string {
} }
func (b *BlockData) key() string { func (b *BlockData) key() string {
return join(b.UncleHeight, b.Orphan, b.Nonce, b.serializeHash(), b.Timestamp, b.Difficulty, b.TotalShares, b.Reward) return join(b.UncleHeight, b.Orphan, b.Nonce, b.serializeHash(), b.Timestamp, b.Difficulty, b.TotalShares, b.Reward, b.Finder)
} }
type Miner struct { type Miner struct {
@ -1137,6 +1138,7 @@ func convertCandidateResults(raw *redis.ZSliceCmd) []*BlockData {
block.Timestamp, _ = strconv.ParseInt(fields[3], 10, 64) block.Timestamp, _ = strconv.ParseInt(fields[3], 10, 64)
block.Difficulty, _ = strconv.ParseInt(fields[4], 10, 64) block.Difficulty, _ = strconv.ParseInt(fields[4], 10, 64)
block.TotalShares, _ = strconv.ParseInt(fields[5], 10, 64) block.TotalShares, _ = strconv.ParseInt(fields[5], 10, 64)
block.Finder = fields[6]
block.candidateKey = v.Member.(string) block.candidateKey = v.Member.(string)
result = append(result, &block) result = append(result, &block)
} }
@ -1182,6 +1184,7 @@ func convertBlockResults(rows ...*redis.ZSliceCmd) []*BlockData {
block.TotalShares, _ = strconv.ParseInt(fields[6], 10, 64) block.TotalShares, _ = strconv.ParseInt(fields[6], 10, 64)
block.RewardString = fields[7] block.RewardString = fields[7]
block.ImmatureReward = fields[7] block.ImmatureReward = fields[7]
block.Finder = fields[8]
block.immatureKey = v.Member.(string) block.immatureKey = v.Member.(string)
result = append(result, &block) result = append(result, &block)
} }

14
www/app/templates/blocks/block.hbs

@ -1,18 +1,24 @@
<tr> <tr>
<td> <td>
{{#if block.uncle}} {{#if block.uncle}}
<a href="{{t "links.blockExplorerLink_uncle"}}{{block.height}}" rel="nofollow" target="_blank">{{format-number block.height}}</a> <a href="{{t "links.blockExplorerLink_uncle"}}{{block.height}}" rel="nofollow"
target="_blank">{{format-number block.height}}</a>
{{else}} {{else}}
<a href="{{t "links.blockExplorerLink_block"}}{{block.height}}" rel="nofollow" target="_blank">{{format-number block.height}}</a> <a href="{{t "links.blockExplorerLink_block"}}{{block.height}}" rel="nofollow"
target="_blank">{{format-number block.height}}</a>
{{/if}} {{/if}}
</td> </td>
<td> <td>
{{#if block.uncle}} {{#if block.uncle}}
<a href="{{t "links.blockExplorerLink_uncle"}}{{block.hash}}" class="hash" rel="nofollow" target="_blank">{{block.hash}}</a>
{{#link-to 'account' block.finder class='hash'}}{{block.finder}}{{/link-to}}
{{else if block.orphan}} {{else if block.orphan}}
<span class="label label-danger">{{t "block.orphan"}}</span> <span class="label label-danger">{{t "block.orphan"}}</span>
{{else}} {{else}}
<a href="{{t "links.blockExplorerLink_block"}}{{block.hash}}" class="hash" rel="nofollow" target="_blank">{{block.hash}}</a>
{{#link-to 'account' block.finder class='hash'}}{{block.finder}}{{/link-to}}
{{/if}} {{/if}}
</td> </td>
<td>{{format-date-locale block.timestamp}}</td> <td>{{format-date-locale block.timestamp}}</td>

Loading…
Cancel
Save