func (cl *OpencxRPC) Register(args RegisterArgs, reply *RegisterReply) (err error) {

	var pubkey *koblitz.PublicKey
	if pubkey, err = cl.Server.RegistrationStringVerify(args.Signature); err != nil {
		return
	}

	defer func() {
		if err != nil {
			err = fmt.Errorf("Error registering user: \n%s", err)
		}
	}()

	// go through each enabled wallet in the server and create a new address for them.
	addrMap := make(map[*coinparam.Params]string)
	for param := range cl.Server.WalletMap {
		if addrMap[param], err = cl.Server.GetAddrForCoin(param, pubkey); err != nil {
			return
		}
	}

	// Do all this locking just cause
	cl.Server.LockIngests()
	// Insert them into the DB
	if err = cl.Server.OpencxDB.RegisterUser(pubkey, addrMap); err != nil {
		// gotta put these here cause if it errors out then oops just locked everything
		cl.Server.UnlockIngests()
		return
	}
	cl.Server.UnlockIngests()

	logging.Infof("Registering user with pubkey %x\n", pubkey.SerializeCompressed())
	// put this in database

	return
}
// Register registers a pubkey into the db, verifies that the action was signed by that pubkey. A valid signature for the string "register" is considered a valid registration.
Register registers a pubkey into the db, verifies that the action was signed by that pubkey. A valid signature for the string "register" is considered a valid registration.
// Register registers a pubkey into the db verifies that the action was signed by that pubkey . A valid signature for the string " register " is considered a valid registration .
func (cl *OpencxRPC) Register(args RegisterArgs, reply *RegisterReply) (err error) {
	var pubkey *koblitz.PublicKey
	if pubkey, err = cl.Server.RegistrationStringVerify(args.Signature); err != nil {
		return
	}
	defer func() {
		if err != nil {
			err = fmt.Errorf("Error registering user: \n%s", err)
		}
	}()
	addrMap := make(map[*coinparam.Params]string)
	for param := range cl.Server.WalletMap {
		if addrMap[param], err = cl.Server.GetAddrForCoin(param, pubkey); err != nil {
			return
		}
	}
	cl.Server.LockIngests()
	if err = cl.Server.OpencxDB.RegisterUser(pubkey, addrMap); err != nil {
		cl.Server.UnlockIngests()
		return
	}
	cl.Server.UnlockIngests()
	logging.Infof("Registering user with pubkey %x\n", pubkey.SerializeCompressed())
	return
}
func ( cl * OpencxRPC ) Register ( args RegisterArgs , reply * RegisterReply ) ( err error ) { var pubkey * koblitz . PublicKey if pubkey , err = cl . Server . RegistrationStringVerify ( args . Signature ) ; err != nil { return } defer func ( ) { if err != nil { err = fmt . Errorf ( " \n " , err ) } } ( ) addrMap := make ( map [ * coinparam . Params ] string ) for param := range cl . Server . WalletMap { if addrMap [ param ] , err = cl . Server . GetAddrForCoin ( param , pubkey ) ; err != nil { return } } cl . Server . LockIngests ( ) if err = cl . Server . OpencxDB . RegisterUser ( pubkey , addrMap ) ; err != nil { cl . Server . UnlockIngests ( ) return } cl . Server . UnlockIngests ( ) logging . Infof ( " \n " , pubkey . SerializeCompressed ( ) ) return }
Register registers a pubkey into the db, verifies that the action was signed by that pubkey.
Register registers a pubkey into the db verifies that the action was signed by that pubkey .
// go through each enabled wallet in the server and create a new address for them. // Do all this locking just cause // Insert them into the DB // gotta put these here cause if it errors out then oops just locked everything // put this in database