Browse Source

login

master
yuriy0803 5 years ago
parent
commit
5c12dd18d9
  1. 7
      storage/redis.go
  2. 4
      www/app/templates/blocks/block.hbs
  3. 2
      www/app/templates/blocks/immature.hbs
  4. 4
      www/app/templates/blocks/pending.hbs

7
storage/redis.go

@ -65,6 +65,7 @@ type RewardData struct {
} }
type BlockData struct { type BlockData struct {
Login string `json:"login"`
Height int64 `json:"height"` Height int64 `json:"height"`
Timestamp int64 `json:"timestamp"` Timestamp int64 `json:"timestamp"`
Difficulty int64 `json:"difficulty"` Difficulty int64 `json:"difficulty"`
@ -103,7 +104,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.Login)
} }
type Miner struct { type Miner struct {
@ -405,7 +406,7 @@ func (r *RedisClient) WriteBlock(login, id string, params []string, diff, roundD
totalShares += n totalShares += n
} }
hashHex := strings.Join(params, ":") hashHex := strings.Join(params, ":")
s := join(hashHex, ts, roundDiff, totalShares) s := join(hashHex, ts, roundDiff, totalShares, login)
cmd := r.client.ZAdd(r.formatKey("blocks", "candidates"), redis.Z{Score: float64(height), Member: s}) cmd := r.client.ZAdd(r.formatKey("blocks", "candidates"), redis.Z{Score: float64(height), Member: s})
return false, cmd.Err() return false, cmd.Err()
} }
@ -1107,6 +1108,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.Login = fields[6]
block.candidateKey = v.Member.(string) block.candidateKey = v.Member.(string)
result = append(result, &block) result = append(result, &block)
} }
@ -1152,6 +1154,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.Login = fields[8]
block.immatureKey = v.Member.(string) block.immatureKey = v.Member.(string)
result = append(result, &block) result = append(result, &block)
} }

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

@ -8,11 +8,11 @@
</td> </td>
<td> <td>
{{#if block.uncle}} {{#if block.uncle}}
<a href="https://expedition.dev/uncle/{{block.hash}}" class="hash" rel="nofollow" target="_blank">{{block.hash}}</a> <a href="https://expedition.dev/uncle/{{block.login}}" class="hash" rel="nofollow" target="_blank">{{block.login}}</a>
{{else if block.orphan}} {{else if block.orphan}}
<span class="label label-danger">Orphan</span> <span class="label label-danger">Orphan</span>
{{else}} {{else}}
<a href="https://expedition.dev/block/{{block.hash}}" class="hash" rel="nofollow" target="_blank">{{block.hash}}</a> <a href="https://expedition.dev/block/{{block.login}}" class="hash" rel="nofollow" target="_blank">{{block.login}}</a>
{{/if}} {{/if}}
</td> </td>
<td>{{format-date-locale block.timestamp}}</td> <td>{{format-date-locale block.timestamp}}</td>

2
www/app/templates/blocks/immature.hbs

@ -4,7 +4,7 @@
<thead> <thead>
<tr> <tr>
<th>Height</th> <th>Height</th>
<th>Block Hash</th> <th>Login</th>
<th>Time Found</th> <th>Time Found</th>
<th>Variance</th> <th>Variance</th>
<th>Reward</th> <th>Reward</th>

4
www/app/templates/blocks/pending.hbs

@ -5,6 +5,7 @@
<thead> <thead>
<tr> <tr>
<th>Height</th> <th>Height</th>
<th>Login</th>
<th>Time Found</th> <th>Time Found</th>
<th>Variance</th> <th>Variance</th>
</tr> </tr>
@ -12,7 +13,8 @@
<tbody> <tbody>
{{#each model.candidates as |block|}} {{#each model.candidates as |block|}}
<tr> <tr>
<td><a href="https://expedition.dev/block/{{block.height}}" rel="nofollow" target="_blank">{{format-number block.height}}</a></td> <td><a href="https://explorer.ellaism.org/block/{{block.height}}" rel="nofollow" target="_blank">{{format-number block.height}}</a></td>
<td>{{#link-to 'account' block.login class='hash'}}{{block.login}}{{/link-to}}</td>
<td>{{format-date-locale block.timestamp}}</td> <td>{{format-date-locale block.timestamp}}</td>
<td> <td>
{{#if block.isLucky}} {{#if block.isLucky}}

Loading…
Cancel
Save