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
Improve send screen #350
Improve send screen #350
Conversation
ben-kaufman
commented
Sep 3, 2020
•
edited
edited
- Make the amount input steps match to the unit selected.
- Add send max button.
- Fix precision error in total amount check.
- Fix possible issue with "Show transaction details" button size.
- Add free-text create transaction editor (as specified in [Feature request] facilitate batch channel opens with LND #338 )
- Add total fee preview (as specified in [Feature request] facilitate batch channel opens with LND #338 )
- Adjust maximum amounts checks to the total fee.
Also sometimes spontaneously fails to calculate fees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weight calculations...
Co-authored-by: Stepan Snigirev <snigirev.stepan@gmail.com>
Co-authored-by: Stepan Snigirev <snigirev.stepan@gmail.com>
Co-authored-by: Stepan Snigirev <snigirev.stepan@gmail.com>
@@ -1033,7 +1050,7 @@ def wallet_sendnew(wallet_alias): | |||
fee_rate = float(request.form.get('fee_rate')) | |||
|
|||
try: | |||
psbt = wallet.createpsbt(addresses, amounts, subtract=subtract, fee_rate=fee_rate, fee_unit=fee_unit, selected_coins=selected_coins) | |||
psbt = wallet.createpsbt(addresses, amounts, subtract=subtract, subtract_from=subtract_from, fee_rate=fee_rate, fee_unit=fee_unit, selected_coins=selected_coins, readonly='estimate_fee' in request.form) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line could be divided into two since it's very long.
src/cryptoadvance/specter/templates/wallet/send/new/components/fee_selection.jinja
Outdated
Show resolved
Hide resolved
src/cryptoadvance/specter/wallet.py
Outdated
else: | ||
if self.recv_descriptor.startswith('wpkh'): | ||
# pubkey, signature | ||
return 75 + 34 | ||
else: | ||
# pubkey, signature, 4* P2SH: 00 14 20-byte-hash | ||
return 75 + 34 + 22 * 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The else
statements could be removed here, right? This would avoid the unnecessary indent.
Thanks for reviewing the code @PulpCattel , I updated with the changes, good catch with the typo :) |
src/cryptoadvance/specter/wallet.py
Outdated
def weight_per_input(self): | ||
"""Calculates the weight of a signed input""" | ||
if self.is_multisig: | ||
input_size = 3 # OP_M OP_N ... OP_CHECKMULTISIG | ||
for i in range(0, len(self.keys)): | ||
# pubkey size | ||
input_size += 34 | ||
for i in range(0, self.sigs_required): | ||
input_size += 75 # max sig size | ||
|
||
if not self.recv_descriptor.startswith('wsh'): | ||
# P2SH scriptsig: 00 20 <32-byte-hash> | ||
input_size += 34 * 4 | ||
return input_size | ||
else: | ||
if self.recv_descriptor.startswith('wpkh'): | ||
# pubkey, signature | ||
return 75 + 34 | ||
# pubkey, signature, 4* P2SH: 00 14 20-byte-hash | ||
return 75 + 34 + 22 * 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I enlightened the lines poorly, also the remaining else
can be removed.
b4d950d
to
575ab25
Compare