node
node copied to clipboard
[Feature request] Change of TransactionFlowResult
Is your feature request related to a problem? Please describe.
Currently the result when sending a transaction via the api (using TransactionFlow
) the result is given as TransactionFlowResult
and contains the following information:
struct TransactionFlowResult
{
1: general.APIResponse status
2: optional general.Variant smart_contract_result //general.Variant
3: i32 roundNum
}
The only useful information in this result at this moment is to know if the transaction is a success, of which we aren't even sure that it even is a success.
When a transaction is sent to a node using the TransactionFlow
method, the node sets the current roundNum
at that point as a result, while the transaction has not been processed yet.
After that a transaction is checked using the checkTransaction
function, which is a check on the node the transaction was sent to. It checks for some basic things, such as sufficient balance, enough fee and a correct signature. When the transaction passes these tests, the node checks if there is anything related to smartcontracts in the transaction. When there is no smart contract data inside the transaction, it passes the transaction to dumb_transaction_flow
(https://github.com/CREDITSCOM/node/blob/dev/api/src/apihandler.cpp line 842/843).
The dumb_transaction_flow
sends the transaction into the network and immediately returns a success, containing both the 'success' message and the signature in hexadecimals. But is it really a success? If so, I'd like to see some more and accurate information regarding the transaction.
Describe the solution you'd like
I'd like to see a change in the TransactionFlowResult
. First of all I should receive the result after the transaction has succesfully been processed in the network and not just on a single node as there is a small chance it fail due to whatever reason.
Next to that I'd like to see the transaction ID returned as well. It might be an idea to use the SealedTransaction
for that.
struct SealedTransaction {
1: TransactionId id
2: Transaction trxn
}
struct TransactionId
{
1: i64 poolSeq
2: i32 index
}
struct Transaction
{
1: TransactionInnerId id
2: general.Address source
3: general.Address target
4: general.Amount amount
5: general.Amount balance
6: Currency currency
7: binary signature
8: optional SmartContractInvocation smartContract
9: AmountCommission fee
10: Time timeCreation
11: optional binary userFields
12: TransactionType type
13: optional SmartTransInfo smartInfo
14: optional list<ExtraFee> extraFee
15: i64 poolNumber
16: optional list<general.Address> usedContracts
}
Describe alternatives you've considered
It's possible to retrieve more information about the transaction after it's processed succesfully while retreiving transactions using TransactionsGet
, but that takes time and creates additional API calls to a node.
Additional context In my opinion this change is good for any developer that uses/want to use the Credits blockchain. Not just developers, but also exchanges can easily display transaction ids this way, making sure deposits/withdrawals are a success.