bridge: do not resubmit submitted VAAs during aggregation
Fixes #49
ghstack-source-id: 8e03ec38f6
Pull Request resolved: https://github.com/certusone/wormhole/pull/53
This commit is contained in:
parent
d3875ba523
commit
58dcc43f17
|
@ -26,6 +26,7 @@ type (
|
||||||
firstObserved time.Time
|
firstObserved time.Time
|
||||||
ourVAA *vaa.VAA
|
ourVAA *vaa.VAA
|
||||||
signatures map[ethcommon.Address][]byte
|
signatures map[ethcommon.Address][]byte
|
||||||
|
submitted bool
|
||||||
}
|
}
|
||||||
|
|
||||||
vaaMap map[string]*vaaState
|
vaaMap map[string]*vaaState
|
||||||
|
@ -227,7 +228,7 @@ func vaaConsensusProcessor(lockC chan *common.ChainLock, setC chan *common.Guard
|
||||||
zap.Int("have_sigs", len(sigs)),
|
zap.Int("have_sigs", len(sigs)),
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(sigs) >= quorum {
|
if len(sigs) >= quorum && !state.vaaSignatures[hash].submitted {
|
||||||
vaaBytes, err := signed.Marshal()
|
vaaBytes, err := signed.Marshal()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -265,6 +266,8 @@ func vaaConsensusProcessor(lockC chan *common.ChainLock, setC chan *common.Guard
|
||||||
zap.String("bytes", hex.EncodeToString(vaaBytes)),
|
zap.String("bytes", hex.EncodeToString(vaaBytes)),
|
||||||
zap.Stringer("target_chain", t.TargetChain))
|
zap.Stringer("target_chain", t.TargetChain))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.vaaSignatures[hash].submitted = true
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Sprintf("unknown VAA payload type: %+v", v))
|
panic(fmt.Sprintf("unknown VAA payload type: %+v", v))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue