From 58dcc43f173e501470d793673426c74a53c5e57d Mon Sep 17 00:00:00 2001 From: Leo Date: Thu, 22 Oct 2020 12:20:14 +0200 Subject: [PATCH] bridge: do not resubmit submitted VAAs during aggregation Fixes #49 ghstack-source-id: 8e03ec38f6d79d20a8ec227aa459c0882cf12f4a Pull Request resolved: https://github.com/certusone/wormhole/pull/53 --- bridge/cmd/guardiand/processor.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bridge/cmd/guardiand/processor.go b/bridge/cmd/guardiand/processor.go index 1e7d8fea..56f58d1e 100644 --- a/bridge/cmd/guardiand/processor.go +++ b/bridge/cmd/guardiand/processor.go @@ -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)) }