novitski / bitcoinj

Automatically exported from code.google.com/p/bitcoinj
Apache License 2.0
0 stars 0 forks source link

make it possible to completeTx without entering the password #552

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In the "send" dialog in Hive, I want to be able to show the actual transaction 
fee that would be added if the user wanted to send a transaction with the 
entered value (and update that fee field in real time). To do this, I need to 
be able to create a temporary SendRequest and then call wallet.completeTx() and 
get the SendRequest's fee. However, this fails because completeTx tries to sign 
the tx with the AES key (which isn't set yet, because the user hasn't entered 
the password yet - they only do this once they fill all the fields and submit 
the dialog), which of course throws an exception, exiting completeTx 
prematurely.

The way I'm using it now is that I run completeTx in a try/catch, ignore the 
exception and then use the inputs/outputs assigned inside completeTx to figure 
out what the fee was, but that's a bit of a hack.

Original issue reported on code.google.com by jakub.su...@gmail.com on 30 Apr 2014 at 7:56

GoogleCodeExporter commented 9 years ago
I need to think about the best fix. Probably it's to make a small start on 
pluggable transaction signers, so you can pick between the real signer and a 
dummy signer.

Original comment by mh.in.en...@gmail.com on 30 Apr 2014 at 8:37

GoogleCodeExporter commented 9 years ago
I think the most tricky issue with this is it isn't possible to lock outputs. 
So when you press send, your outputs can have been spent from another wallet 
and the fee change.

Original comment by andreas....@gmail.com on 30 Apr 2014 at 9:15

GoogleCodeExporter commented 9 years ago
That only happens if the user themselves is spending from the same wallet (or a 
clone of it) simultaneously. In that case, OK, they get a slightly inaccurate 
GUI ... 

Original comment by mh.in.en...@gmail.com on 30 Apr 2014 at 9:36

GoogleCodeExporter commented 9 years ago
Yes, exactly.

Original comment by andreas....@gmail.com on 1 May 2014 at 6:18

GoogleCodeExporter commented 9 years ago
Does setting SendRequest.signInputs to false fix this? I think it should work.

Original comment by mh.in.en...@gmail.com on 15 Jul 2014 at 12:10

GoogleCodeExporter commented 9 years ago
I don't know about Jakub, but I had a very similar usecase and problem and 
.signInputs fixed it for me.

Original comment by andreas....@gmail.com on 15 Jul 2014 at 12:16

GoogleCodeExporter commented 9 years ago
The signInputs=false looks like a good way to do it.

Also, I think it'd be a good idea to double check all the inputs are unspent 
just before you sign the tx. (Just in case a user is using another wallet 
simultaneously).

Original comment by jimburto...@gmail.com on 16 Jul 2014 at 1:00

GoogleCodeExporter commented 9 years ago
I think setting signInputs to false should resolve this request.

Original comment by mh.in.en...@gmail.com on 3 Aug 2014 at 7:10