This commit is contained in:
Fernando Torres 2024-04-24 16:51:20 -03:00
parent 01afaab67b
commit 9873e2aadf
No known key found for this signature in database
GPG Key ID: 962617117C40D42A
6 changed files with 10 additions and 4 deletions

View File

@ -49,7 +49,8 @@ func (p *Publisher) Publish(ctx context.Context, e *watcher.Event) {
TxHash: e.TxHash,
Version: e.Version,
Revision: e.Revision,
Hash: e.Hash,
Digest: e.Digest,
Overwrite: e.DuplicatedFixed,
}
// In some scenarios the fly component that inserts the VAA documents does not have the txhash field available,

View File

@ -19,7 +19,8 @@ type Event struct {
TxHash string `json:"txHash"`
Version uint16 `json:"version"`
Revision uint16 `json:"revision"`
Hash []byte `json:"hash"`
Digest string `json:"digest"`
Overwrite bool `json:"overwrite"`
}
// PushFunc is a function to push VAAEvent.

View File

@ -50,8 +50,9 @@ type Event struct {
TxHash string `bson:"txHash"`
Version uint16 `bson:"version"`
Revision uint16 `bson:"revision"`
Hash []byte `bson:"hash"`
Digest string `bson:"digest"`
IsDuplicated bool `bson:"isDuplicated"`
DuplicatedFixed bool `bson:"duplicatedFixed"`
}
const queryTemplate = `

View File

@ -114,7 +114,7 @@ func (c *Consumer) processSourceTx(ctx context.Context, msg queue.ConsumerMessag
Vaa: event.Vaa,
IsVaaSigned: event.IsVaaSigned,
Metrics: c.metrics,
Overwrite: false, // avoid processing the same transaction twice
Overwrite: event.Overwrite, // avoid processing the same transaction twice
Source: event.Source,
}
_, err := ProcessSourceTx(ctx, c.logger, c.rpcpool, c.wormchainRpcPool, c.repository, &p, c.p2pNetwork)

View File

@ -25,6 +25,7 @@ type VaaEvent struct {
TxHash string `json:"txHash"`
Version uint16 `json:"version"`
Revision uint16 `json:"revision"`
Overwrite bool `json:"overwrite"`
}
// VaaConverter converts a message from a VAAEvent.
@ -49,6 +50,7 @@ func NewVaaConverter(log *zap.Logger) ConverterFunc {
Vaa: vaaEvent.Vaa,
IsVaaSigned: true,
TxHash: vaaEvent.TxHash,
Overwrite: vaaEvent.Overwrite,
}, nil
}
}

View File

@ -51,6 +51,7 @@ type Event struct {
Vaa []byte
IsVaaSigned bool
Attributes any
Overwrite bool
}
func GetAttributes[T EventAttributes](e *Event) (T, bool) {