Compare commits

...

2 Commits

Author SHA1 Message Date
eab6dbd74c
Check if index is within range 2024-11-19 16:23:35 +03:00
6159686a8e
update function comment 2024-11-19 16:21:55 +03:00
2 changed files with 7 additions and 2 deletions

View File

@ -77,6 +77,11 @@ func GetTransferData(ctx context.Context, db storage.PrefixDb, publicKey string,
dates := strings.Split(string(data["txdate"]), "\n")
syms := strings.Split(string(data["txsym"]), "\n")
// Check if index is within range
if index < 1 || index > len(senders) {
return "", fmt.Errorf("transaction not found: index %d out of range", index)
}
// Adjust for 0-based indexing
i := index - 1
transactionType := "received"

View File

@ -1754,8 +1754,8 @@ func (h *Handlers) GetTransactionsList(ctx context.Context, sym string, input []
return res, nil
}
// ViewTransactionStatement retrieves the token holding and balance from the subprefixDB
// and displays it to the user for them to select it
// ViewTransactionStatement retrieves the transaction statement
// and displays it to the user
func (h *Handlers) ViewTransactionStatement(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result
sessionId, ok := ctx.Value("SessionId").(string)