mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-27 05:42:56 +00:00
keys: support returning legacy verification script
When one works with legacy (NEO2) wallets, it is useful to have access to old verification script formats.
This commit is contained in:
parent
270377637a
commit
f5cb035996
1 changed files with 6 additions and 0 deletions
|
@ -242,6 +242,12 @@ func (p *PublicKey) EncodeBinary(w *io.BinWriter) {
|
|||
func (p *PublicKey) GetVerificationScript() []byte {
|
||||
b := p.Bytes()
|
||||
buf := io.NewBufBinWriter()
|
||||
if address.Prefix == address.NEO2Prefix {
|
||||
buf.WriteB(0x21) // PUSHBYTES33
|
||||
buf.WriteBytes(p.Bytes())
|
||||
buf.WriteB(0xAC) // CHECKSIG
|
||||
return buf.Bytes()
|
||||
}
|
||||
emit.Bytes(buf.BinWriter, b)
|
||||
emit.Opcode(buf.BinWriter, opcode.PUSHNULL)
|
||||
emit.Syscall(buf.BinWriter, "Neo.Crypto.ECDsaVerify")
|
||||
|
|
Loading…
Reference in a new issue