Skip to content

Commit

Permalink
Merge pull request #125 from flow-hydraulics/latenssi/fix-address-con…
Browse files Browse the repository at this point in the history
…fusion-2

Make sure distribution issuer is not the PDS admin
  • Loading branch information
latenssi authored Nov 2, 2021
2 parents 78859d8 + 17bb721 commit df7ab7a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions service/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package app

import (
"context"
"fmt"

"github.com/flow-hydraulics/flow-pds/service/common"
"github.com/flow-hydraulics/flow-pds/service/config"
Expand Down Expand Up @@ -54,6 +55,11 @@ func (app *App) SetDistCap(ctx context.Context, issuer common.FlowAddress) error

// CreateDistribution validates a distribution, resolves it and stores it in database
func (app *App) CreateDistribution(ctx context.Context, distribution *Distribution) error {
// Check that distribution issuer address does not equal to AdminAddress
if distribution.Issuer == common.FlowAddressFromString(app.cfg.AdminAddress) {
return fmt.Errorf("issuer account should not be the same as PDS admin account")
}

// Resolve will also validate the distribution
if err := distribution.Resolve(); err != nil {
return err
Expand Down

0 comments on commit df7ab7a

Please sign in to comment.