mirror of
https://github.com/tendermint/tendermint.git
synced 2026-07-29 11:32:56 +00:00
extract tags from DeliverTx/Result
and send them along with predefined
This commit is contained in:
+13
-1
@@ -82,7 +82,19 @@ func (b *EventBus) PublishEventVote(vote EventDataVote) error {
|
||||
func (b *EventBus) PublishEventTx(tx EventDataTx) error {
|
||||
// no explicit deadline for publishing events
|
||||
ctx := context.Background()
|
||||
b.pubsub.PublishWithTags(ctx, TMEventData{tx}, map[string]interface{}{EventTypeKey: EventTx, TxHashKey: fmt.Sprintf("%X", tx.Tx.Hash())})
|
||||
tags := make(map[string]interface{})
|
||||
for _, t := range tx.Tags {
|
||||
// TODO [@melekes]: validate, but where?
|
||||
if t.ValueString != "" {
|
||||
tags[t.Key] = t.ValueString
|
||||
} else {
|
||||
tags[t.Key] = t.ValueInt
|
||||
}
|
||||
}
|
||||
// predefined tags should come last
|
||||
tags[EventTypeKey] = EventTx
|
||||
tags[TxHashKey] = fmt.Sprintf("%X", tx.Tx.Hash())
|
||||
b.pubsub.PublishWithTags(ctx, TMEventData{tx}, tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
+7
-6
@@ -110,12 +110,13 @@ type EventDataNewBlockHeader struct {
|
||||
|
||||
// All txs fire EventDataTx
|
||||
type EventDataTx struct {
|
||||
Height int `json:"height"`
|
||||
Tx Tx `json:"tx"`
|
||||
Data data.Bytes `json:"data"`
|
||||
Log string `json:"log"`
|
||||
Code abci.CodeType `json:"code"`
|
||||
Error string `json:"error"` // this is redundant information for now
|
||||
Height int `json:"height"`
|
||||
Tx Tx `json:"tx"`
|
||||
Data data.Bytes `json:"data"`
|
||||
Log string `json:"log"`
|
||||
Code abci.CodeType `json:"code"`
|
||||
Tags []*abci.KVPair `json:"tags"`
|
||||
Error string `json:"error"` // this is redundant information for now
|
||||
}
|
||||
|
||||
type EventDataProposalHeartbeat struct {
|
||||
|
||||
Reference in New Issue
Block a user