示例#1
0
// MutateSetOptions for ClearFlag sets the SetOptionsOp's ClearFlags field
func (m ClearFlag) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
	if !isFlagValid(xdr.AccountFlags(m)) {
		return errors.New("Unknown flag in SetFlag mutator")
	}

	var val xdr.Uint32
	if o.ClearFlags == nil {
		val = xdr.Uint32(m)
	} else {
		val = xdr.Uint32(m) | *o.ClearFlags
	}
	o.ClearFlags = &val
	return
}
示例#2
0
func (is *Session) effectFlagDetails(flagDetails map[string]bool, flagPtr *xdr.Uint32, setValue bool) {
	if flagPtr != nil {
		flags := xdr.AccountFlags(*flagPtr)

		if flags&xdr.AccountFlagsAuthRequiredFlag != 0 {
			flagDetails["auth_required_flag"] = setValue
		}
		if flags&xdr.AccountFlagsAuthRevocableFlag != 0 {
			flagDetails["auth_revocable_flag"] = setValue
		}
		if flags&xdr.AccountFlagsAuthImmutableFlag != 0 {
			flagDetails["auth_immutable_flag"] = setValue
		}
	}
}