Skip to content

Commit

Permalink
Add checks to ValidForBlockInclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Aug 11, 2020
1 parent 4b93c5d commit 922d568
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions chain/types/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ func (m *Message) ValidForBlockInclusion(minGas int64) error {
return xerrors.New("'From' address cannot be empty")
}

if m.Value.Int == nil {
return xerrors.New("'Value' cannot be nil")
}

if m.Value.LessThan(big.Zero()) {
return xerrors.New("'Value' field cannot be negative")
}
Expand All @@ -150,10 +154,18 @@ func (m *Message) ValidForBlockInclusion(minGas int64) error {
return xerrors.New("'Value' field cannot be greater than total filecoin supply")
}

if m.GasFeeCap.Int == nil {
return xerrors.New("'GasFeeCap' cannot be nil")
}

if m.GasFeeCap.LessThan(big.Zero()) {
return xerrors.New("'GasFeeCap' field cannot be negative")
}

if m.GasPremium.Int == nil {
return xerrors.New("'GasPremium' cannot be nil")
}

if m.GasPremium.LessThan(big.Zero()) {
return xerrors.New("'GasPremium' field cannot be negative")
}
Expand Down

0 comments on commit 922d568

Please sign in to comment.