Skip to content
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

Implement exchange API. #77

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

StanleyDing
Copy link
Contributor

No description provided.


for addr, color_amount_map in addr_in_map.items():
utxos = get_rpc_connection().gettxoutaddress(addr)
for color, amount in color_amount_map.items():
Copy link

Choose a reason for hiding this comment

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

如果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)
Copy link

@Jsying Jsying Oct 7, 2016

Choose a reason for hiding this comment

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

ins裡的utxo的amount應該大於或等於outs的amount。這邊要算找錢

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'], {})
Copy link

@Jsying Jsying Oct 7, 2016

Choose a reason for hiding this comment

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

希望vouts不要加起來,才有辦法在transaction裡,看到比較清楚的交換內容。

Exchange API is not limited to exchange between 2 address.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants