mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-04 12:03:41 +02:00
app/ship_processor.go: Include Blocknum and Timestamp in ActionTrace messages.
This commit is contained in:
parent
ae6f3f11a9
commit
4ec78c38df
1 changed files with 68 additions and 65 deletions
|
|
@ -43,7 +43,9 @@ func SpawnProccessor(shipStream *shipclient.Stream, writer api.Writer, abi *abi.
|
||||||
|
|
||||||
// Attach handlers
|
// Attach handlers
|
||||||
shipStream.BlockHandler = processor.processBlock
|
shipStream.BlockHandler = processor.processBlock
|
||||||
shipStream.TraceHandler = processor.processTraces
|
|
||||||
|
// Needed because if nil, traces will not be included in the response from ship.
|
||||||
|
shipStream.TraceHandler = func([]*ship.TransactionTraceV0) {}
|
||||||
|
|
||||||
return processor
|
return processor
|
||||||
}
|
}
|
||||||
|
|
@ -77,16 +79,11 @@ func (processor *ShipProcessor) processBlock(block *ship.GetBlocksResultV0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
processor.encodeQueue(api.HeartbeatChannel, hb)
|
processor.encodeQueue(api.HeartbeatChannel, hb)
|
||||||
|
|
||||||
err := processor.writer.Flush()
|
|
||||||
if err != nil {
|
|
||||||
log.WithError(err).Error("Failed to send messages")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (processor *ShipProcessor) processTraces(traces []*ship.TransactionTraceV0) {
|
// Process traces
|
||||||
for _, trace := range traces {
|
if block.Traces != nil && len(block.Traces.Elem) > 0 {
|
||||||
|
for _, trace := range block.Traces.AsTransactionTracesV0() {
|
||||||
|
|
||||||
processor.encodeQueue(api.TransactionChannel, trace)
|
processor.encodeQueue(api.TransactionChannel, trace)
|
||||||
|
|
||||||
|
|
@ -116,6 +113,8 @@ func (processor *ShipProcessor) processTraces(traces []*ship.TransactionTraceV0)
|
||||||
|
|
||||||
act := message.ActionTrace{
|
act := message.ActionTrace{
|
||||||
TxID: trace.ID.String(),
|
TxID: trace.ID.String(),
|
||||||
|
BlockNum: block.Block.BlockNumber(),
|
||||||
|
Timestamp: block.Block.Timestamp.Time.UTC(),
|
||||||
Name: act_trace.Act.Name.String(),
|
Name: act_trace.Act.Name.String(),
|
||||||
Contract: act_trace.Act.Account.String(),
|
Contract: act_trace.Act.Account.String(),
|
||||||
Receiver: act_trace.Receiver.String(),
|
Receiver: act_trace.Receiver.String(),
|
||||||
|
|
@ -157,6 +156,7 @@ func (processor *ShipProcessor) processTraces(traces []*ship.TransactionTraceV0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err := processor.writer.Flush()
|
err := processor.writer.Flush()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -164,6 +164,9 @@ func (processor *ShipProcessor) processTraces(traces []*ship.TransactionTraceV0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (processor *ShipProcessor) processTraces([]*ship.TransactionTraceV0) {
|
||||||
|
}
|
||||||
|
|
||||||
func (processor *ShipProcessor) Close() error {
|
func (processor *ShipProcessor) Close() error {
|
||||||
return processor.writer.Close()
|
return processor.writer.Close()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue