From 21da34da3906a47ee109b69bb643c75b264a70a6 Mon Sep 17 00:00:00 2001 From: yuriy0803 <68668177+yuriy0803@users.noreply.github.com> Date: Fri, 12 Mar 2021 17:50:57 +0100 Subject: [PATCH] Update redis.go --- storage/redis.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/storage/redis.go b/storage/redis.go index 98f67f1..86c87db 100644 --- a/storage/redis.go +++ b/storage/redis.go @@ -440,15 +440,10 @@ func (r *RedisClient) WriteBlock(login, id string, params []string, diff, roundD } func (r *RedisClient) writeShare(tx *redis.Multi, ms, ts int64, login, id string, diff int64, expire time.Duration) { - /* # Note To Me: - Will have to write to get from redis the current value for round - shares and increase by 1, then include the new number to be added to redis - */ - -// Moved get hostname to stratums - - - tx.LPush(r.formatKey("lastshares"), login) + times := int(diff / 1000000000) + for i := 0; i < times; i++ { + tx.LPush(r.formatKey("lastshares"), login) + } tx.LTrim(r.formatKey("lastshares"), 0, r.pplns) tx.HIncrBy(r.formatKey("shares", "roundCurrent"), login, diff) tx.ZAdd(r.formatKey("hashrate"), redis.Z{Score: float64(ts), Member: join(diff, login, id, ms)})