node: include and log TxHash field in SignedObservation
Optional metadata for debugging. Allows tying a received observation to an on-chain transaction even if the node missed the observation. Change-Id: Ie50c10c8ab7f65469555674d90645f91092fb2e3
This commit is contained in:
parent
7a4cac2dde
commit
0feaed4e80
|
@ -22,7 +22,7 @@ var (
|
|||
})
|
||||
)
|
||||
|
||||
func (p *Processor) broadcastSignature(v *vaa.VAA, signature []byte) {
|
||||
func (p *Processor) broadcastSignature(v *vaa.VAA, signature []byte, txhash []byte) {
|
||||
digest, err := v.SigningMsg()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -32,6 +32,7 @@ func (p *Processor) broadcastSignature(v *vaa.VAA, signature []byte) {
|
|||
Addr: crypto.PubkeyToAddress(p.gk.PublicKey).Bytes(),
|
||||
Hash: digest.Bytes(),
|
||||
Signature: signature,
|
||||
TxHash: txhash,
|
||||
}
|
||||
|
||||
w := gossipv1.GossipMessage{Message: &gossipv1.GossipMessage_SignedObservation{SignedObservation: &obsv}}
|
||||
|
|
|
@ -44,5 +44,5 @@ func (p *Processor) handleInjection(ctx context.Context, v *vaa.VAA) {
|
|||
zap.String("signature", hex.EncodeToString(s)))
|
||||
|
||||
vaaInjectionsTotal.Inc()
|
||||
p.broadcastSignature(v, s)
|
||||
p.broadcastSignature(v, s, nil)
|
||||
}
|
||||
|
|
|
@ -98,5 +98,5 @@ func (p *Processor) handleMessage(ctx context.Context, k *common.MessagePublicat
|
|||
|
||||
p.attestationEvents.ReportMessagePublication(&reporter.MessagePublication{VAA: *v, InitiatingTxID: k.TxHash})
|
||||
|
||||
p.broadcastSignature(v, s)
|
||||
p.broadcastSignature(v, s, k.TxHash.Bytes())
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
node_common "github.com/certusone/wormhole/node/pkg/common"
|
||||
"github.com/certusone/wormhole/node/pkg/db"
|
||||
"github.com/certusone/wormhole/node/pkg/reporter"
|
||||
"github.com/mr-tron/base58"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"time"
|
||||
|
@ -55,7 +56,10 @@ func (p *Processor) handleObservation(ctx context.Context, m *gossipv1.SignedObs
|
|||
p.logger.Info("received observation",
|
||||
zap.String("digest", hash),
|
||||
zap.String("signature", hex.EncodeToString(m.Signature)),
|
||||
zap.String("addr", hex.EncodeToString(m.Addr)))
|
||||
zap.String("addr", hex.EncodeToString(m.Addr)),
|
||||
zap.String("txhash", hex.EncodeToString(m.TxHash)),
|
||||
zap.String("txhash_b58", base58.Encode(m.TxHash)),
|
||||
)
|
||||
|
||||
observationsReceivedTotal.Inc()
|
||||
|
||||
|
|
|
@ -78,6 +78,9 @@ message SignedObservation {
|
|||
bytes hash = 2;
|
||||
// ECSDA signature of the hash using the node's guardian key.
|
||||
bytes signature = 3;
|
||||
// Transaction hash this observation was made from.
|
||||
// Optional, included for observability.
|
||||
bytes tx_hash = 4;
|
||||
}
|
||||
|
||||
// A SignedVAAWithQuorum message is sent by nodes whenever one of the VAAs they observed
|
||||
|
|
Loading…
Reference in New Issue