bridge: always gate Terra features on the main feature flag

This commit is contained in:
Leo 2020-11-30 17:13:48 +01:00
parent a77f89f646
commit 106fecca00
3 changed files with 23 additions and 3 deletions

View File

@ -347,7 +347,24 @@ func runBridge(cmd *cobra.Command, args []string) {
return err
}
p := processor.NewProcessor(ctx, lockC, setC, sendC, obsvC, solanaVaaC, injectC, gk, *unsafeDevMode, *devNumGuardians, *ethRPC, *terraLCD, *terraChaidID, *terraContract, *terraFeePayer)
// TODO: this thing has way too many arguments at this point - make it an options struct
p := processor.NewProcessor(ctx,
lockC,
setC,
sendC,
obsvC,
solanaVaaC,
injectC,
gk,
*unsafeDevMode,
*devNumGuardians,
*ethRPC,
*terraSupport,
*terraLCD,
*terraChaidID,
*terraContract,
*terraFeePayer,
)
if err := supervisor.Run(ctx, "processor", p.Run); err != nil {
return err
}

View File

@ -217,7 +217,7 @@ func (p *Processor) terraVAASubmission(ctx context.Context, signed *vaa.VAA, has
// - https://github.com/certusone/wormhole/issues/97
//
// Roadmap: https://github.com/certusone/wormhole/milestone/4
if !p.devnetMode || p.terraChaidID == "" {
if !p.devnetMode || !p.terraEnabled {
p.logger.Warn("ignoring terra VAA submission",
zap.String("digest", hash))
return

View File

@ -62,6 +62,7 @@ type Processor struct {
devnetNumGuardians uint
devnetEthRPC string
terraEnabled bool
terraLCD string
terraChaidID string
terraContract string
@ -93,6 +94,7 @@ func NewProcessor(
devnetMode bool,
devnetNumGuardians uint,
devnetEthRPC string,
terraEnabled bool,
terraLCD string,
terraChaidID string,
terraContract string,
@ -110,6 +112,7 @@ func NewProcessor(
devnetNumGuardians: devnetNumGuardians,
devnetEthRPC: devnetEthRPC,
terraEnabled: terraEnabled,
terraLCD: terraLCD,
terraChaidID: terraChaidID,
terraContract: terraContract,
@ -168,7 +171,7 @@ func (p *Processor) checkDevModeGuardianSetUpdate(ctx context.Context) error {
p.logger.Info("devnet guardian set change submitted to Ethereum", zap.Any("trx", trx), zap.Any("vaa", v))
if p.terraChaidID != "" {
if p.terraEnabled {
// Submit to Terra
trxResponse, err := terra.SubmitVAA(timeout, p.terraLCD, p.terraChaidID, p.terraContract, p.terraFeePayer, v)
if err != nil {