Skip to content

Commit

Permalink
[types]remove two fields in preprocess request (#439)
Browse files Browse the repository at this point in the history
* remove two fields in preprocess request
  • Loading branch information
jingweicb authored Sep 19, 2022
1 parent 2fa41fd commit b34d797
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 55 deletions.
12 changes: 0 additions & 12 deletions asserter/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,18 +319,6 @@ func (a *Asserter) ConstructionPreprocessRequest(
)
}

if err := AssertUniqueAmounts(request.MaxFee); err != nil {
return fmt.Errorf("max fee %s is invalid: %w", types.PrintStruct(request.MaxFee), err)
}

if request.SuggestedFeeMultiplier != nil && *request.SuggestedFeeMultiplier < 0 {
return fmt.Errorf(
"suggested fee multiplier %f is invalid: %w",
*request.SuggestedFeeMultiplier,
ErrConstructionPreprocessRequestSuggestedFeeMultiplierIsNeg,
)
}

return nil
}

Expand Down
43 changes: 0 additions & 43 deletions asserter/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,8 +914,6 @@ func TestConstructionDeriveRequest(t *testing.T) {
}

func TestConstructionPreprocessRequest(t *testing.T) {
positiveFeeMultiplier := float64(1.1)
negativeFeeMultiplier := float64(-1.1)
var tests = map[string]struct {
request *types.ConstructionPreprocessRequest
err error
Expand All @@ -928,31 +926,9 @@ func TestConstructionPreprocessRequest(t *testing.T) {
err: nil,
},
"valid request with suggested fee multiplier": {
request: &types.ConstructionPreprocessRequest{
NetworkIdentifier: validNetworkIdentifier,
Operations: validOps,
SuggestedFeeMultiplier: &positiveFeeMultiplier,
},
err: nil,
},
"valid request with max fee": {
request: &types.ConstructionPreprocessRequest{
NetworkIdentifier: validNetworkIdentifier,
Operations: validOps,
MaxFee: []*types.Amount{
validAmount,
},
},
err: nil,
},
"valid request with suggested fee multiplier and max fee": {
request: &types.ConstructionPreprocessRequest{
NetworkIdentifier: validNetworkIdentifier,
Operations: validOps,
MaxFee: []*types.Amount{
validAmount,
},
SuggestedFeeMultiplier: &positiveFeeMultiplier,
},
err: nil,
},
Expand Down Expand Up @@ -997,25 +973,6 @@ func TestConstructionPreprocessRequest(t *testing.T) {
},
err: ErrOperationStatusNotEmptyForConstruction,
},
"negative suggested fee multiplier": {
request: &types.ConstructionPreprocessRequest{
NetworkIdentifier: validNetworkIdentifier,
Operations: validOps,
SuggestedFeeMultiplier: &negativeFeeMultiplier,
},
err: ErrConstructionPreprocessRequestSuggestedFeeMultiplierIsNeg,
},
"max fee with duplicate currency": {
request: &types.ConstructionPreprocessRequest{
NetworkIdentifier: validNetworkIdentifier,
Operations: validOps,
MaxFee: []*types.Amount{
validAmount,
validAmount,
},
},
err: ErrCurrencyUsedMultipleTimes,
},
}

for name, test := range tests {
Expand Down

0 comments on commit b34d797

Please sign in to comment.