Merge pull request #11 from nspcc-dev/neo3/bind
Add "Bind" and "Unbind" methods
This commit is contained in:
commit
f5d2e96063
1 changed files with 24 additions and 0 deletions
|
@ -35,6 +35,7 @@ const (
|
|||
candidatesKey = "candidates"
|
||||
cashedChequesKey = "cheques"
|
||||
blockDiff = 20 // change base on performance evaluation
|
||||
publicKeySize = 33
|
||||
)
|
||||
|
||||
func Main(op string, args []interface{}) interface{} {
|
||||
|
@ -228,6 +229,29 @@ func Main(op string, args []interface{}) interface{} {
|
|||
runtime.Notify("Cheque", id, user, amount, lockAcc)
|
||||
}
|
||||
|
||||
return true
|
||||
case "Bind", "Unbind":
|
||||
if len(args) < 2 {
|
||||
panic("binding: bad arguments")
|
||||
}
|
||||
|
||||
user := args[0].([]byte)
|
||||
if !runtime.CheckWitness(user) {
|
||||
panic("binding: you should be the owner of the wallet")
|
||||
}
|
||||
|
||||
var keys [][]byte
|
||||
for i := 1; i < len(args); i++ {
|
||||
pub := args[i].([]byte)
|
||||
if len(pub) != publicKeySize {
|
||||
panic("binding: incorrect public key size")
|
||||
}
|
||||
|
||||
keys = append(keys, pub)
|
||||
}
|
||||
|
||||
runtime.Notify(op, user, keys)
|
||||
|
||||
return true
|
||||
case "InnerRingUpdate":
|
||||
data := args[0].([]byte)
|
||||
|
|
Loading…
Reference in a new issue