-
Notifications
You must be signed in to change notification settings - Fork 77
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
rpc: implement getcontractstate RPC #662
Conversation
b0994e9
to
3576686
Compare
Codecov Report
@@ Coverage Diff @@
## master #662 +/- ##
==========================================
+ Coverage 65.08% 65.14% +0.06%
==========================================
Files 125 125
Lines 10568 10588 +20
==========================================
+ Hits 6878 6898 +20
Misses 3412 3412
Partials 278 278
Continue to review full report at Codecov.
|
3576686
to
b34b9ad
Compare
b34b9ad
to
974aa5f
Compare
Name: "getcontractstate_called", | ||
Namespace: "neogo", | ||
}, | ||
) |
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.
gofmt.
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.
Done
pkg/rpc/server.go
Outdated
if cs != nil { | ||
results = wrappers.NewContractState(cs) | ||
} else { | ||
results = "Unknown contract" |
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.
Is it returned as an error or as a result in C# node?
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 returned as en error, done
pkg/rpc/wrappers/contract_state.go
Outdated
|
||
// NewContractState creates a new Contract wrapper. | ||
func NewContractState(c *state.Contract) ContractState { | ||
scriptHash, err := util.Uint160DecodeBytesBE(c.ScriptHash().BytesLE()) |
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'm not sure what are you doing here, c.ScriptHash()
is already an Uint160
, if you need to reverse the byte order it has a Reverse
method.
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.
Done: used c.ScriptHash().Reverse()
Also, documentation should be updated. |
fa995fd
to
8800cc5
Compare
8800cc5
to
0388122
Compare
closes #342