(sink *common.ZeroCopySink, pubkeys []keypair.PublicKey, m int)
| 101 | } |
| 102 | |
| 103 | func EncodeMultiPubKeyProgramInto(sink *common.ZeroCopySink, pubkeys []keypair.PublicKey, m int) error { |
| 104 | n := len(pubkeys) |
| 105 | if !(1 <= m && m <= n && n > 1 && n <= constants.MULTI_SIG_MAX_PUBKEY_SIZE) { |
| 106 | return errors.New("wrong multi-sig param") |
| 107 | } |
| 108 | |
| 109 | pubkeys = keypair.SortPublicKeys(pubkeys) |
| 110 | |
| 111 | builder := ProgramBuilder{sink: sink} |
| 112 | builder.PushNum(uint16(m)) |
| 113 | for _, pubkey := range pubkeys { |
| 114 | key := keypair.SerializePublicKey(pubkey) |
| 115 | builder.PushBytes(key) |
| 116 | } |
| 117 | |
| 118 | builder.PushNum(uint16(len(pubkeys))) |
| 119 | builder.PushOpCode(neovm.CHECKMULTISIG) |
| 120 | return nil |
| 121 | } |
| 122 | |
| 123 | func ProgramFromMultiPubKey(pubkeys []keypair.PublicKey, m int) ([]byte, error) { |
| 124 | sink := common.ZeroCopySink{} |
no test coverage detected