+8
-8
cmd/goat/plc.go
+8
-8
cmd/goat/plc.go
···
562
563
func runPLCSubmit(cctx *cli.Context) error {
564
ctx := context.Background()
565
-
expect_genesis := cctx.Bool("genesis")
566
-
did_string := cctx.String("did")
567
568
-
if !expect_genesis && did_string == "" {
569
return fmt.Errorf("exactly one of either --genesis or --did must be specified")
570
}
571
572
-
if expect_genesis && did_string != "" {
573
return fmt.Errorf("exactly one of either --genesis or --did must be specified")
574
}
575
···
594
}
595
op := enum.AsOperation()
596
597
-
if op.IsGenesis() != expect_genesis {
598
-
if expect_genesis {
599
return fmt.Errorf("expected genesis operation, but a non-genesis operation was provided")
600
} else {
601
return fmt.Errorf("expected non-genesis operation, but a genesis operation was provided")
···
603
}
604
605
if op.IsGenesis() {
606
-
did_string, err = op.DID()
607
if err != nil {
608
return err
609
}
···
618
UserAgent: GOAT_PLC_USER_AGENT,
619
}
620
621
-
if err = c.Submit(ctx, did_string, op); err != nil {
622
return err
623
}
624
···
562
563
func runPLCSubmit(cctx *cli.Context) error {
564
ctx := context.Background()
565
+
expectGenesis := cctx.Bool("genesis")
566
+
didString := cctx.String("did")
567
568
+
if !expectGenesis && didString == "" {
569
return fmt.Errorf("exactly one of either --genesis or --did must be specified")
570
}
571
572
+
if expectGenesis && didString != "" {
573
return fmt.Errorf("exactly one of either --genesis or --did must be specified")
574
}
575
···
594
}
595
op := enum.AsOperation()
596
597
+
if op.IsGenesis() != expectGenesis {
598
+
if expectGenesis {
599
return fmt.Errorf("expected genesis operation, but a non-genesis operation was provided")
600
} else {
601
return fmt.Errorf("expected non-genesis operation, but a genesis operation was provided")
···
603
}
604
605
if op.IsGenesis() {
606
+
didString, err = op.DID()
607
if err != nil {
608
return err
609
}
···
618
UserAgent: GOAT_PLC_USER_AGENT,
619
}
620
621
+
if err = c.Submit(ctx, didString, op); err != nil {
622
return err
623
}
624