Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Implement api_send_transfer #65

Merged
merged 4 commits into from
Feb 13, 2019
Merged

Conversation

jkrvivian
Copy link
Member

@jkrvivian jkrvivian commented Feb 11, 2019

ta_send_transfer_res_serialize is removed because api_send_transfer returns the transaction object instead of transaction hash.

Close #8

accelerator/server.cc Outdated Show resolved Hide resolved
.post([&](served::response& res, const served::request& req) {
char* json_result;

if (req.header("content-type") != "application/json") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does operator != perform byte-by-byte character comparison?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to spec 21.4.8.3 operator !=
The above comparison fit this situation:

template<class charT, class traits, class Allocator>
   bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
                            const charT* rhs);
Requires: rhs points to an array of at least traits::length(rhs) + 1elements of charT.
Returns: lhs.compare(rhs) != 0

And compare performs byte-by-byte character comparison, in [1] it uses the phrase lexicographical comparison([2]).

references:

@wusyong
Copy link

wusyong commented Feb 12, 2019

Forgot to mention that after memory double free error has been fixed on dcurl. We should add pow_init() and pow_destroy() in ta_attach_to_tangle or somewhere else if you find it's more appropriate.

@jkrvivian
Copy link
Member Author

@wusyong ,
Got it! I'll add it in ta_attach_to_tangle

@jserv
Copy link
Member

jserv commented Feb 13, 2019

Is there relevant test case available?

@jkrvivian
Copy link
Member Author

jkrvivian commented Feb 13, 2019

Is there relevant test case available?

@jserv , We've tested here:

curl  localhost:8000/transaction -X POST -H "content-type:application/json" \
 -d \
'{"value":0,"tag":"TATATATATATATATATATATATATAT",\
"message":"TANGLEACCELERATORROCKS",\
"address":"9MIZW9SISDRQIVNVNBAPVWVMANZZFNXTGUDDISTYXKMFHLITTOSVFOUESIYINJLQLJAXVDRAI99NYFLPY"}'

The transaction can be found on tangle explorer!!
message: tangle accelerator rocks

@jserv
Copy link
Member

jserv commented Feb 13, 2019

The transaction can be found on tangle explorer!!
message: tangle accelerator rocks

cool. It takes 1 min to be confirmed.

@jserv jserv merged commit feec246 into DLTcollab:master Feb 13, 2019
@jkrvivian jkrvivian deleted the api_send_transfer branch February 13, 2019 07:06
@wusyong wusyong mentioned this pull request Feb 13, 2019
2 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants