ethapi: add personal.signTransaction#15971
Conversation
| return nil, err | ||
| } | ||
| return &SignTransactionResult{data, tx}, nil | ||
| } |
There was a problem hiding this comment.
Seems like an awfully lot of duplicated code. Can't we make SendTransaction call SignTransaction and submit the transaction at the end (instead of having the same thing copy-pasted twice)?
There was a problem hiding this comment.
Or if we want to avoid the RLP encoding, then perhaps make a common step that just returns the signer transaction and then SendTransaction can submit it, whilst SignTransaction can RLP encode and return it.
|
Fixed, PTAL |
|
Should we allow passing in a |
|
I think it would be safer to explicitly disallow the |
|
So, my primary usecase is offline transactions, and in those cases the user should supply all values himself, rather than rely on defaults. So I'm ok with that.. (and still call ? |
|
Hold on though. We already have |
|
PTAL, changed the behaviour of |
|
Testing: |
* ethapi: add personal.signTransaction * ethapi: refactor to minimize duplicate code * ethapi: make nonce,gas,gasPrice obligatory in signTransaction
* ethapi: add personal.signTransaction * ethapi: refactor to minimize duplicate code * ethapi: make nonce,gas,gasPrice obligatory in signTransaction
This pr adds
personal.signTransaction( <tx> , <pw>), which is a deficiency at the moment.In order to create offline transactions, there's currently no great way to accomplish that:
unlockis dangerous for various reasons--nodiscover --maxpeers=0, and usepersonal.sendTransaction(<tx>,<pw>).transactions.rlp, and geth will broadcast these on the next startup unless the file is deleted.This pr resolves #15953