Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/validate_rpcfundaccountsrequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

# Validate RPCFundAccountsRequest
4 changes: 4 additions & 0 deletions rhp/v4/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,10 @@ func RPCFundAccounts(ctx context.Context, t TransportClient, cs consensus.State,
RenterSignature: revision.RenterSignature,
}

if err := req.Validate(); err != nil {
return RPCFundAccountResult{}, fmt.Errorf("invalid request: %w", err)
}

var resp rhp4.RPCFundAccountsResponse
if err := callSingleRoundtripRPC(ctx, t, rhp4.RPCFundAccountsID, &req, &resp); err != nil {
return RPCFundAccountResult{}, err
Expand Down
2 changes: 2 additions & 0 deletions rhp/v4/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ func (s *Server) handleRPCFundAccounts(stream net.Conn) error {
var req rhp4.RPCFundAccountsRequest
if err := rhp4.ReadRequest(stream, &req); err != nil {
return errorDecodingError("failed to read request: %v", err)
} else if err := req.Validate(); err != nil {
return err
}

state, unlock, err := s.lockContractForRevision(req.ContractID)
Expand Down