1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-16 04:24:56 +02:00

ship_processor.go: also publish transactions to redis.

This commit is contained in:
Henrik Hautakoski 2022-01-20 11:24:18 +01:00
parent 93c9f8a721
commit 6cdb596b41
No known key found for this signature in database
GPG key ID: 608414D93E862CCD

View file

@ -17,8 +17,18 @@ func processBlock(block *ship.GetBlocksResultV0) {
func processTraces(traces []*ship.TransactionTraceV0) {
for _, trace := range traces {
//log.Println("Trace ID:", trace.ID)
payload, err := json.Marshal(trace)
if err == nil {
channel := RedisKey("transactions")
if err := RedisPublish(channel, payload).Err(); err != nil {
log.Printf("Failed to post to channel '%s': %s", channel, err)
}
} else {
log.Println("Failed to encode transaction:", err)
}
// Actions
for _, actionTraceVar := range trace.ActionTraces {
trace := actionTraceVar.Impl.(*ship.ActionTraceV0)