wallet: provide (*Account).SignHashable API

Make PrivateKey() less used and less useful.
This commit is contained in:
Roman Khimov 2022-09-01 20:42:42 +03:00
parent e569edc841
commit e164625a7f
10 changed files with 24 additions and 16 deletions

View file

@ -74,7 +74,7 @@ func (s *signer) ScriptHash() util.Uint160 {
// SignHashable implements Signer interface.
func (s *signer) SignHashable(magic uint32, item hash.Hashable) []byte {
return append([]byte{byte(opcode.PUSHDATA1), 64},
(*wallet.Account)(s).PrivateKey().SignHashable(magic, item)...)
(*wallet.Account)(s).SignHashable(netmode.Magic(magic), item)...)
}
// SignTx implements Signer interface.
@ -130,7 +130,7 @@ func (m multiSigner) Script() []byte {
func (m multiSigner) SignHashable(magic uint32, item hash.Hashable) []byte {
var script []byte
for i := 0; i < m.m; i++ {
sign := m.accounts[i].PrivateKey().SignHashable(magic, item)
sign := m.accounts[i].SignHashable(netmode.Magic(magic), item)
script = append(script, byte(opcode.PUSHDATA1), 64)
script = append(script, sign...)
}