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

Return error for Horizon.Problem in transaction_async request #5447

Closed
wants to merge 4 commits into from
Closed
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
9 changes: 7 additions & 2 deletions ingest/ledgerbackend/buffered_storage_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,9 @@ func TestLedgerBufferBoundedObjectNotFound(t *testing.T) {
bsb.ledgerBuffer.wg.Wait()

_, err := bsb.GetLedger(ctx, 3)
assert.EqualError(t, err, "failed getting next ledger batch from queue: ledger object containing sequence 3 is missing: file does not exist")
assert.ErrorContains(t, err, "ledger object containing sequence 3 is missing")
assert.ErrorContains(t, err, objectName)
assert.ErrorContains(t, err, "file does not exist")
}

func TestLedgerBufferUnboundedObjectNotFound(t *testing.T) {
Expand Down Expand Up @@ -571,5 +573,8 @@ func TestLedgerBufferRetryLimit(t *testing.T) {
bsb.ledgerBuffer.wg.Wait()

_, err := bsb.GetLedger(context.Background(), 3)
assert.EqualError(t, err, "failed getting next ledger batch from queue: maximum retries exceeded for downloading object containing sequence 3: transient error")
assert.ErrorContains(t, err, "failed getting next ledger batch from queue")
assert.ErrorContains(t, err, "maximum retries exceeded for downloading object containing sequence 3")
assert.ErrorContains(t, err, objectName)
assert.ErrorContains(t, err, "transient error")
}
2 changes: 1 addition & 1 deletion ingest/ledgerbackend/ledger_buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (lb *ledgerBuffer) downloadLedgerObject(ctx context.Context, sequence uint3

reader, err := lb.dataStore.GetFile(ctx, objectKey)
if err != nil {
return nil, err
return nil, errors.Wrapf(err, "unable to retrieve file: %s", objectKey)
}

defer reader.Close()
Expand Down
2 changes: 1 addition & 1 deletion protocols/horizon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ type AsyncTransactionSubmissionResponse struct {
// ErrorResultXDR is present only if Status is equal to proto.TXStatusError.
// ErrorResultXDR is a TransactionResult xdr string which contains details on why
// the transaction could not be accepted by stellar-core.
ErrorResultXDR string `json:"errorResultXdr,omitempty"`
ErrorResultXDR string `json:"error_result_xdr,omitempty"`
// TxStatus represents the status of the transaction submission returned by stellar-core.
// It can be one of: proto.TXStatusPending, proto.TXStatusDuplicate,
// proto.TXStatusTryAgainLater, or proto.TXStatusError.
Expand Down
6 changes: 3 additions & 3 deletions services/horizon/internal/httpx/static/txsub_async_oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ paths:
ErrorStatusExample:
summary: ERROR Status from core
value:
errorResultXdr: "AAAAAAAAAGT////7AAAAAA=="
error_result_xdr: "AAAAAAAAAGT////7AAAAAA=="
tx_status: "ERROR"
hash: "6cbb7f714bd08cea7c30cab7818a35c510cbbfc0a6aa06172a1e94146ecf0165"
'405':
Expand All @@ -78,7 +78,7 @@ paths:
schema:
$ref: '#/components/schemas/AsyncTransactionSubmissionResponse'
example:
errorResultXdr: ""
error_result_xdr: ""
tx_status: "DUPLICATE"
hash: "6cbb7f714bd08cea7c30cab7818a35c510cbbfc0a6aa06172a1e94146ecf0165"
'500':
Expand Down Expand Up @@ -136,7 +136,7 @@ components:
AsyncTransactionSubmissionResponse:
type: object
properties:
errorResultXdr:
error_result_xdr:
type: string
nullable: true
description: TransactionResult XDR string which is present only if the submission status from core is an ERROR.
Expand Down
Loading