Skip to content

Commit 70c99af

Browse files
authored
Merge pull request #401 from SiaFoundation/matt/validate-fund-accounts
validate RPCFundAccountsRequest
2 parents a855c3d + 1232cb2 commit 70c99af

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
default: patch
3+
---
4+
5+
# Validate RPCFundAccountsRequest

rhp/v4/rpc.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,10 @@ func RPCFundAccounts(ctx context.Context, t TransportClient, cs consensus.State,
689689
RenterSignature: revision.RenterSignature,
690690
}
691691

692+
if err := req.Validate(); err != nil {
693+
return RPCFundAccountResult{}, fmt.Errorf("invalid request: %w", err)
694+
}
695+
692696
var resp rhp4.RPCFundAccountsResponse
693697
if err := callSingleRoundtripRPC(ctx, t, rhp4.RPCFundAccountsID, &req, &resp); err != nil {
694698
return RPCFundAccountResult{}, err

rhp/v4/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ func (s *Server) handleRPCFundAccounts(stream net.Conn) error {
397397
var req rhp4.RPCFundAccountsRequest
398398
if err := rhp4.ReadRequest(stream, &req); err != nil {
399399
return errorDecodingError("failed to read request: %v", err)
400+
} else if err := req.Validate(); err != nil {
401+
return err
400402
}
401403

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

0 commit comments

Comments
 (0)