-
Notifications
You must be signed in to change notification settings - Fork 15
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
tx resource contains operations #863
Conversation
Codecov Report
@@ Coverage Diff @@
## master #863 +/- ##
==========================================
+ Coverage 58.21% 60.16% +1.95%
==========================================
Files 154 154
Lines 10996 11003 +7
==========================================
+ Hits 6401 6620 +219
+ Misses 3847 3607 -240
- Partials 748 776 +28
Continue to review full report at Codecov.
|
bb4157f
to
0cf875b
Compare
0cf875b
to
9797c81
Compare
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.
note
@@ -106,27 +103,3 @@ func TriggerEvent(st *storage.LevelDBBackend, transactions []*transaction.Transa | |||
} | |||
|
|||
} | |||
|
|||
func renderEventStream(args ...interface{}) ([]byte, error) { |
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.
the renderEventStream function is used only by the subscribe API
and it is impossible to get data from storage with this design.
Hence, this function is moved into subscribe API handler and let the function use the closure.
@@ -27,6 +31,7 @@ func (t Transaction) GetMap() hal.Entry { | |||
"sequence_id": t.bt.SequenceID, | |||
"created": t.bt.Created, | |||
"operation_count": len(t.bt.Operations), | |||
"operations": t.tx.B.Operations, |
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.
the shape of operation
in the transaction resource may differ from operation resource
.
But I think that the operation resource
will be deprecated and relevant APIs no longer under maintenance.
review please @spikeekips @anarcher @Geod24 |
} | ||
i := args[1] | ||
|
||
if i == nil { |
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.
This check should be folded into line 47 so the error is the same
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.
line 47 checks the length of arguments
and this line is for checking the first argument value is nil
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.
Yes, but making a difference here does not matter and only looks confusing. Having both checks done together is more consistent.
t, hasNext, c := iterFunc() | ||
if !hasNext { | ||
break | ||
} |
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.
This should be part of the for
condition, instead of infinite loop + break
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.
It is a matter of style.
And I was trying to make it for init; cond; after {}
style,
the init value is deallocated when the for loop is finished.
I mean, the t
is deallocated.
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.
I mean, the
t
is deallocated.
It goes out of scope. But so does it, with the current code. So I don't see the point.
} | ||
payload = resource.NewTransaction(&bt) | ||
return payload, nil | ||
found, err := block.ExistsBlockTransaction(api.storage, key) |
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.
Instead of exists
+ get
, why don't you get it directly ?
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.
To distinguish error in the database and no error but not exist.
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.
b141b77
to
c10c002
Compare
Ping @anarcher @spikeekips @Geod24 |
@cmcm2222 When this merged, please update the API document according to this change. |
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.
LGTM!
@cmcm2222 Could you test this PR and update the Document? |
@cmcm2222 ping |
@kfangw OK. I will check it |
Do not use Operation Hash for validation Identifier the operation is changed to Tx + Index
5daf848
to
f89b71e
Compare
update API doc based on bosnet/sebak#863
Github Issue
#862
Background
see #862
Solution
Transaction Resource contains operations
Possible Drawbacks