-
Notifications
You must be signed in to change notification settings - Fork 19
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
library function for api call "anchors" #130
Conversation
That is because the original code path that factomd parses anchors is on insertion of entries into the database. So that is the height that you did the upgrade to the ethereum anchor parsing version. But if you restart your node with I agree it should have been a null instead of a bool there |
Ah, interesting. The custom unmarshaller is still necessary due to local chains not having anchors but that's good to know. |
@carryforward can we merge it into master while preparing the next release? |
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.
Can you add a test like you did for #140?
unit test added |
* anchors support * allow request for height 0 * anchor unit test
* anchors support * allow request for height 0 * anchor unit test
closes: #125
Adds two functions to the library:
GetAnchors(hash string)
andGetAnchorsByHeight(height int64)
which cover the available parameters of the "anchors" endpoint: https://docs.factom.com/api#anchorsThey return the response in the form of an
Anchors
struct. I ran into some difficulties as factomd only has ethereum anchors starting at height202428
and before that it returns "false". Same for Bitcoin anchors in non-mainnet chains.To avoid having to deal with unmarshalling into an interface{} and then painstakingly transferring the data to a struct, I opted to just find-replace "false" with "null" for the ethereum and bitcoin fields.