diff --git a/storage/redis.go b/storage/redis.go index ddeb255..413084d 100644 --- a/storage/redis.go +++ b/storage/redis.go @@ -65,6 +65,7 @@ type RewardData struct { } type BlockData struct { + Login string `json:"login"` Height int64 `json:"height"` Timestamp int64 `json:"timestamp"` Difficulty int64 `json:"difficulty"` @@ -103,7 +104,7 @@ func (b *BlockData) RoundKey() 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 { @@ -405,7 +406,7 @@ func (r *RedisClient) WriteBlock(login, id string, params []string, diff, roundD totalShares += n } 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}) return false, cmd.Err() } @@ -1107,6 +1108,7 @@ func convertCandidateResults(raw *redis.ZSliceCmd) []*BlockData { block.Timestamp, _ = strconv.ParseInt(fields[3], 10, 64) block.Difficulty, _ = strconv.ParseInt(fields[4], 10, 64) block.TotalShares, _ = strconv.ParseInt(fields[5], 10, 64) + block.Login = fields[6] block.candidateKey = v.Member.(string) result = append(result, &block) } @@ -1152,6 +1154,7 @@ func convertBlockResults(rows ...*redis.ZSliceCmd) []*BlockData { block.TotalShares, _ = strconv.ParseInt(fields[6], 10, 64) block.RewardString = fields[7] block.ImmatureReward = fields[7] + block.Login = fields[8] block.immatureKey = v.Member.(string) result = append(result, &block) } diff --git a/www/app/templates/blocks/block.hbs b/www/app/templates/blocks/block.hbs index c37e418..791d070 100644 --- a/www/app/templates/blocks/block.hbs +++ b/www/app/templates/blocks/block.hbs @@ -8,11 +8,11 @@ {{#if block.uncle}} - {{block.hash}} + {{block.login}} {{else if block.orphan}} Orphan {{else}} - {{block.hash}} + {{block.login}} {{/if}} {{format-date-locale block.timestamp}} diff --git a/www/app/templates/blocks/immature.hbs b/www/app/templates/blocks/immature.hbs index ae7cab5..8108d70 100644 --- a/www/app/templates/blocks/immature.hbs +++ b/www/app/templates/blocks/immature.hbs @@ -4,7 +4,7 @@ Height - Block Hash + Login Time Found Variance Reward diff --git a/www/app/templates/blocks/pending.hbs b/www/app/templates/blocks/pending.hbs index 74a64db..ccd56f9 100644 --- a/www/app/templates/blocks/pending.hbs +++ b/www/app/templates/blocks/pending.hbs @@ -5,6 +5,7 @@ Height + Login Time Found Variance @@ -12,8 +13,9 @@ {{#each model.candidates as |block|}} - {{format-number block.height}} - {{format-date-locale block.timestamp}} + {{format-number block.height}} + {{#link-to 'account' block.login class='hash'}}{{block.login}}{{/link-to}} + {{format-date-locale block.timestamp}} {{#if block.isLucky}} {{format-number block.variance style='percent'}}