mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 11:41:48 +00:00
keys: simplify error handling for PublicKey() and associated
PublicKey() for PrivateKey now just can't fail and it makes no sense to return an error from it. There is a lot of associated functionality for which this also is true, so adjust it accordingly and simplify a lot of code.
This commit is contained in:
parent
60bc2e8053
commit
2c3e92923f
10 changed files with 40 additions and 74 deletions
|
@ -25,9 +25,7 @@ func CreateRawContractTransaction(params ContractTxParams) (*transaction.Transac
|
|||
wif, assetID, address, amount, balancer = params.wif, params.assetID, params.address, params.value, params.balancer
|
||||
)
|
||||
|
||||
if fromAddress, err = wif.PrivateKey.Address(); err != nil {
|
||||
return nil, errs.Wrapf(err, "Failed to take address from WIF: %v", wif.S)
|
||||
}
|
||||
fromAddress = wif.PrivateKey.Address()
|
||||
|
||||
if fromAddressHash, err = crypto.Uint160DecodeAddress(fromAddress); err != nil {
|
||||
return nil, errs.Wrapf(err, "Failed to take script hash from address: %v", fromAddress)
|
||||
|
@ -59,9 +57,7 @@ func CreateRawContractTransaction(params ContractTxParams) (*transaction.Transac
|
|||
if witness.InvocationScript, err = GetInvocationScript(tx, wif); err != nil {
|
||||
return nil, errs.Wrap(err, "Failed to create invocation script")
|
||||
}
|
||||
if witness.VerificationScript, err = wif.GetVerificationScript(); err != nil {
|
||||
return nil, errs.Wrap(err, "Failed to create verification script")
|
||||
}
|
||||
witness.VerificationScript = wif.GetVerificationScript()
|
||||
tx.Scripts = append(tx.Scripts, &witness)
|
||||
tx.Hash()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue