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

Improve send screen #350

Merged
merged 26 commits into from Sep 8, 2020
Merged

Conversation

ben-kaufman
Copy link
Contributor

@ben-kaufman ben-kaufman commented Sep 3, 2020

@stepansnigirev
Copy link
Collaborator

Fee estimation doesn't work from text edit
Screenshot 2020-09-04 at 14 33 36

@stepansnigirev
Copy link
Collaborator

Also sometimes spontaneously fails to calculate fees.

Copy link
Collaborator

@stepansnigirev stepansnigirev left a comment

Choose a reason for hiding this comment

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

Weight calculations...

src/cryptoadvance/specter/wallet.py Outdated Show resolved Hide resolved
src/cryptoadvance/specter/wallet.py Outdated Show resolved Hide resolved
src/cryptoadvance/specter/wallet.py Outdated Show resolved Hide resolved
ben-kaufman and others added 7 commits September 4, 2020 19:58
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>
@ben-kaufman ben-kaufman marked this pull request as ready for review September 5, 2020 06:06
@ben-kaufman ben-kaufman changed the title WIP: Improve send screen Improve send screen Sep 5, 2020
@stepansnigirev
Copy link
Collaborator

stepansnigirev commented Sep 5, 2020

When I click on "Create unsigned transaction" there is an error appearing on the top of the screen "You can not send more than 'my max amount'" even if everything is fine. The transaction is created fine after that though.
Screenshot 2020-09-05 at 10 44 14

Also makes sense to show recalculated fee in the transaction details:
Screenshot 2020-09-05 at 10 43 03

@stepansnigirev
Copy link
Collaborator

Also I would assume that if my UOA is satoshi, in the text field I would also enter satoshis.
Or explicitly say that in text field we use BTC. Or add a btc-sat radio button.
Screenshot 2020-09-05 at 10 47 36

@stepansnigirev
Copy link
Collaborator

Can't send... First, fee is not rounded to satoshi, also it complains about 0 in the manual fees, but it switched to manual fees automatically when I clicked on "estimate fees".

Screenshot 2020-09-07 at 14 10 11

@@ -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)
Copy link
Contributor

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.

Comment on lines 892 to 898
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
Copy link
Contributor

@PulpCattel PulpCattel Sep 7, 2020

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.

Co-authored-by: Luke <51127079+PulpCattel@users.noreply.github.com>
@ben-kaufman
Copy link
Contributor Author

Thanks for reviewing the code @PulpCattel , I updated with the changes, good catch with the typo :)

Comment on lines 878 to 897
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
Copy link
Contributor

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.

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.

None yet

3 participants