Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[types]remove two fields in preprocess request #439

Merged
merged 2 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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