-
Notifications
You must be signed in to change notification settings - Fork 18
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
new core-go #465
base: rc/v1.7.next1
Are you sure you want to change the base?
new core-go #465
Conversation
5d5e537
README.md
Outdated
@@ -35,6 +35,7 @@ For more details, go [here](https://docs.multiversx.com/sdk-and-tools/proxy/). | |||
- `/v1.0/transaction/cost` (POST) --> receives a single transaction in JSON format and returns it's cost | |||
- `/v1.0/transaction/:txHash` (GET) --> returns the transaction which corresponds to the hash | |||
- `/v1.0/transaction/:txHash?withResults=true` (GET) --> returns the transaction and results which correspond to the hash | |||
- `/v1.0/transaction/:txHash?withResults=true&withRelayedTxHash=:relayedTxHash` (GET) --> returns the inner transaction which corresponds to the hash and was part of the relayedTxHash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the suffix with
(since, currently, we use with
to dictate whether something has to be included in the response).
common/options.go
Outdated
@@ -49,6 +49,8 @@ const ( | |||
UrlParameterWithAlteredAccounts = "withAlteredAccounts" | |||
// UrlParameterWithKeys represents the name of an URL parameter | |||
UrlParameterWithKeys = "withKeys" | |||
// UrlParameterWithRelayedTxHash represents the name of an URL parameter | |||
UrlParameterWithRelayedTxHash = "withRelayedTxHash" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the with
prefix. This new parameter is closer (in meaning) to hintEpoch
than to withTxs
.
process/transactionProcessor.go
Outdated
func isResultOfInnerTx(allScrs []*transaction.ApiSmartContractResult, currentScr *transaction.ApiSmartContractResult, innerTxHash string) bool { | ||
if currentScr.PrevTxHash == innerTxHash { | ||
return true | ||
} | ||
|
||
parentScr := getParentSCR(allScrs, currentScr.PrevTxHash) | ||
if check.IfNilReflect(parentScr) { | ||
return false | ||
} | ||
|
||
return isResultOfInnerTx(allScrs, parentScr, innerTxHash) | ||
} | ||
|
||
func getParentSCR(allScrs []*transaction.ApiSmartContractResult, hash string) *transaction.ApiSmartContractResult { | ||
for _, scr := range allScrs { | ||
if scr.Hash == hash { | ||
return scr | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentScr
is used for its PrevTxHash
only. Thus, an optimization would be to hold a map of [previous hash] to [hash]. This way, the repeated loops can be omitted. However, in practice, the optimization would only be marginal. Thus, all right as it is now, as well 👍
process/transactionProcessor.go
Outdated
return isResultOfInnerTx(allScrs, parentScr, innerTxHash) | ||
} | ||
|
||
func getParentSCR(allScrs []*transaction.ApiSmartContractResult, hash string) *transaction.ApiSmartContractResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe can be named findSCRByHash()
.
No description provided.