-
Notifications
You must be signed in to change notification settings - Fork 19.7k
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
ethapi: add personal.signTransaction #15971
Conversation
internal/ethapi/api.go
Outdated
return nil, err | ||
} | ||
return &SignTransactionResult{data, tx}, nil | ||
} |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
|
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.
LGTM
* 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:
unlock
is 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