Merge pull request #1115 from nspcc-dev/fix/convert

keys: support returning legacy verification script
This commit is contained in:
Roman Khimov 2020-07-10 19:27:36 +03:00 committed by GitHub
commit 56a8f11ad6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -277,6 +277,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")