Guest User

Untitled

a guest
Mar 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. local count = tonumber(KEYS[1])
  2. local transactions = {}
  3.  
  4. local txs = redis.call("ZREVRANGEBYSCORE", "transactions:order", "+inf", "-inf", "LIMIT", "0", count)
  5.  
  6. for k,v in pairs(txs) do
  7. local txKey = redis.call("KEYS", "block_tx:*:" .. v .. ":detail")
  8. local txDetail = redis.call("HGETALL", unpack(txKey))
  9.  
  10. local txDetails = {}
  11.  
  12. local nextkey
  13. for i, v in ipairs(txDetail) do
  14. if i % 2 == 1 then
  15. nextkey = v
  16. else
  17. txDetails[nextkey] = v
  18. end
  19. end
  20.  
  21. transactions[k] = txDetails
  22. end
  23.  
  24. return cjson.encode(transactions)
Add Comment
Please, Sign In to add comment