mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 01:41:48 +00:00
wallet: provide (*Account).SignHashable API
Make PrivateKey() less used and less useful.
This commit is contained in:
parent
e569edc841
commit
e164625a7f
10 changed files with 24 additions and 16 deletions
|
@ -17,10 +17,8 @@ import (
|
|||
func InitAndSave(net netmode.Magic, tx *transaction.Transaction, acc *wallet.Account, filename string) error {
|
||||
scCtx := context.NewParameterContext("Neo.Network.P2P.Payloads.Transaction", net, tx)
|
||||
if acc != nil && acc.CanSign() {
|
||||
priv := acc.PrivateKey()
|
||||
pub := priv.PublicKey()
|
||||
sign := priv.SignHashable(uint32(net), tx)
|
||||
if err := scCtx.AddSignature(acc.ScriptHash(), acc.Contract, pub, sign); err != nil {
|
||||
sign := acc.SignHashable(net, tx)
|
||||
if err := scCtx.AddSignature(acc.ScriptHash(), acc.Contract, acc.PublicKey(), sign); err != nil {
|
||||
return fmt.Errorf("can't add signature: %w", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue