Simplify `src/wallet/wallet.py` a bit.
This commit is contained in:
parent
62d50e0002
commit
92f2c3b4d9
|
@ -115,8 +115,9 @@ class Wallet(AbstractWallet):
|
||||||
).puzzle_hash
|
).puzzle_hash
|
||||||
|
|
||||||
def make_solution(
|
def make_solution(
|
||||||
self, primaries=None, min_time=0, me=None, consumed=None, fee=None
|
self, primaries=None, min_time=0, me=None, consumed=None, fee=0
|
||||||
):
|
):
|
||||||
|
assert fee >= 0
|
||||||
condition_list = []
|
condition_list = []
|
||||||
if primaries:
|
if primaries:
|
||||||
for primary in primaries:
|
for primary in primaries:
|
||||||
|
@ -248,10 +249,7 @@ class Wallet(AbstractWallet):
|
||||||
changepuzzlehash = await self.get_new_puzzlehash()
|
changepuzzlehash = await self.get_new_puzzlehash()
|
||||||
primaries.append({"puzzlehash": changepuzzlehash, "amount": change})
|
primaries.append({"puzzlehash": changepuzzlehash, "amount": change})
|
||||||
|
|
||||||
if fee > 0:
|
|
||||||
solution = self.make_solution(primaries=primaries, fee=fee)
|
solution = self.make_solution(primaries=primaries, fee=fee)
|
||||||
else:
|
|
||||||
solution = self.make_solution(primaries=primaries)
|
|
||||||
output_created = True
|
output_created = True
|
||||||
elif output_created is False and origin_id == coin.name():
|
elif output_created is False and origin_id == coin.name():
|
||||||
primaries = [{"puzzlehash": newpuzzlehash, "amount": amount}]
|
primaries = [{"puzzlehash": newpuzzlehash, "amount": amount}]
|
||||||
|
@ -259,10 +257,7 @@ class Wallet(AbstractWallet):
|
||||||
changepuzzlehash = await self.get_new_puzzlehash()
|
changepuzzlehash = await self.get_new_puzzlehash()
|
||||||
primaries.append({"puzzlehash": changepuzzlehash, "amount": change})
|
primaries.append({"puzzlehash": changepuzzlehash, "amount": change})
|
||||||
|
|
||||||
if fee > 0:
|
|
||||||
solution = self.make_solution(primaries=primaries, fee=fee)
|
solution = self.make_solution(primaries=primaries, fee=fee)
|
||||||
else:
|
|
||||||
solution = self.make_solution(primaries=primaries)
|
|
||||||
output_created = True
|
output_created = True
|
||||||
else:
|
else:
|
||||||
solution = self.make_solution()
|
solution = self.make_solution()
|
||||||
|
|
Loading…
Reference in New Issue