Implement exchange API.#77
Open
StanleyDing wants to merge 2 commits intoblockchain-foundry:developfrom
Open
Conversation
Jsying
reviewed
Oct 7, 2016
oss_server/base/v1/views.py
Outdated
|
|
||
| for addr, color_amount_map in addr_in_map.items(): | ||
| utxos = get_rpc_connection().gettxoutaddress(addr) | ||
| for color, amount in color_amount_map.items(): |
There was a problem hiding this comment.
如果color是1且這個addr=fee_address可能會有問題,color 1其實不夠,選到重複的utxo
| for color, amount in color_amount_map.items(): | ||
| outs = [{'address': addr, 'value': int(amount * 10**8), 'color': color}] | ||
|
|
||
| raw_tx = make_raw_tx(ins, outs) |
There was a problem hiding this comment.
ins裡的utxo的amount應該大於或等於outs的amount。這邊要算找錢
oss_server/base/v1/views.py
Outdated
| addr2_in = addr_in_map.setdefault(tx['address2'], {}) | ||
| addr2_in[tx['color2']] = addr1_in.get(tx['color2'], 0) + tx['amount2'] | ||
|
|
||
| addr1_out = addr_out_map.setdefault(tx['address1'], {}) |
There was a problem hiding this comment.
希望vouts不要加起來,才有辦法在transaction裡,看到比較清楚的交換內容。
Exchange API is not limited to exchange between 2 address.
435f2ce to
5007e92
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.