Commit 651709cd authored by Moul's avatar Moul

[mod] tx: move f() in a more appropriate place

parent 27798a06
......@@ -182,6 +182,28 @@ async def transaction_confirmation(
return tx
async def get_list_input_for_transaction(pubkey, TXamount):
listinput, amount = await get_sources(pubkey)
# generate final list source
listinputfinal = []
totalAmountInput = 0
intermediatetransaction = False
for input in listinput:
listinputfinal.append(input)
totalAmountInput += amount_in_current_base(input)
TXamount -= amount_in_current_base(input)
# if more 40 sources, it's an intermediate transaction
if len(listinputfinal) >= 40:
intermediatetransaction = True
break
if TXamount <= 0:
break
if TXamount > 0 and not intermediatetransaction:
message_exit("Error: you don't have enough money")
return listinputfinal, totalAmountInput, intermediatetransaction
async def handle_intermediaries_transactions(
key, issuers, AmountTransfered, outputAddresses, Comment="", OutputbackChange=None
):
......@@ -353,28 +375,6 @@ def generate_output(listoutput, unitbase, rest, recipient_address):
unitbase = unitbase - 1
async def get_list_input_for_transaction(pubkey, TXamount):
listinput, amount = await get_sources(pubkey)
# generate final list source
listinputfinal = []
totalAmountInput = 0
intermediatetransaction = False
for input in listinput:
listinputfinal.append(input)
totalAmountInput += amount_in_current_base(input)
TXamount -= amount_in_current_base(input)
# if more 40 sources, it's an intermediate transaction
if len(listinputfinal) >= 40:
intermediatetransaction = True
break
if TXamount <= 0:
break
if TXamount > 0 and not intermediatetransaction:
message_exit("Error: you don't have enough money")
return listinputfinal, totalAmountInput, intermediatetransaction
def checkComment(Comment):
if len(Comment) > 255:
message_exit("Error: Comment is too long")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment