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:
Leo 2020-10-22 12:20:14 +02:00
parent d3875ba523
commit 58dcc43f17
1 changed files with 4 additions and 1 deletions

View File

@ -26,6 +26,7 @@ type (
firstObserved time.Time
ourVAA *vaa.VAA
signatures map[ethcommon.Address][]byte
submitted bool
}
vaaMap map[string]*vaaState
@ -227,7 +228,7 @@ func vaaConsensusProcessor(lockC chan *common.ChainLock, setC chan *common.Guard
zap.Int("have_sigs", len(sigs)),
)
if len(sigs) >= quorum {
if len(sigs) >= quorum && !state.vaaSignatures[hash].submitted {
vaaBytes, err := signed.Marshal()
if err != nil {
panic(err)
@ -265,6 +266,8 @@ func vaaConsensusProcessor(lockC chan *common.ChainLock, setC chan *common.Guard
zap.String("bytes", hex.EncodeToString(vaaBytes)),
zap.Stringer("target_chain", t.TargetChain))
}
state.vaaSignatures[hash].submitted = true
} else {
panic(fmt.Sprintf("unknown VAA payload type: %+v", v))
}