github.com/annchain/OG@v0.0.9/consensus/campaign/termchange_gen.go (about)

     1  package campaign
     2  
     3  // Code generated by github.com/tinylib/msgp DO NOT EDIT.
     4  
     5  import (
     6  	"github.com/annchain/OG/common"
     7  	"github.com/tinylib/msgp/msgp"
     8  )
     9  
    10  // DecodeMsg implements msgp.Decodable
    11  func (z *SigSet) DecodeMsg(dc *msgp.Reader) (err error) {
    12  	var zb0001 uint32
    13  	zb0001, err = dc.ReadArrayHeader()
    14  	if err != nil {
    15  		err = msgp.WrapError(err)
    16  		return
    17  	}
    18  	if zb0001 != 2 {
    19  		err = msgp.ArrayError{Wanted: 2, Got: zb0001}
    20  		return
    21  	}
    22  	err = z.PublicKey.DecodeMsg(dc)
    23  	if err != nil {
    24  		err = msgp.WrapError(err, "PublicKey")
    25  		return
    26  	}
    27  	err = z.Signature.DecodeMsg(dc)
    28  	if err != nil {
    29  		err = msgp.WrapError(err, "Signature")
    30  		return
    31  	}
    32  	return
    33  }
    34  
    35  // EncodeMsg implements msgp.Encodable
    36  func (z *SigSet) EncodeMsg(en *msgp.Writer) (err error) {
    37  	// array header, size 2
    38  	err = en.Append(0x92)
    39  	if err != nil {
    40  		return
    41  	}
    42  	err = z.PublicKey.EncodeMsg(en)
    43  	if err != nil {
    44  		err = msgp.WrapError(err, "PublicKey")
    45  		return
    46  	}
    47  	err = z.Signature.EncodeMsg(en)
    48  	if err != nil {
    49  		err = msgp.WrapError(err, "Signature")
    50  		return
    51  	}
    52  	return
    53  }
    54  
    55  // MarshalMsg implements msgp.Marshaler
    56  func (z *SigSet) MarshalMsg(b []byte) (o []byte, err error) {
    57  	o = msgp.Require(b, z.Msgsize())
    58  	// array header, size 2
    59  	o = append(o, 0x92)
    60  	o, err = z.PublicKey.MarshalMsg(o)
    61  	if err != nil {
    62  		err = msgp.WrapError(err, "PublicKey")
    63  		return
    64  	}
    65  	o, err = z.Signature.MarshalMsg(o)
    66  	if err != nil {
    67  		err = msgp.WrapError(err, "Signature")
    68  		return
    69  	}
    70  	return
    71  }
    72  
    73  // UnmarshalMsg implements msgp.Unmarshaler
    74  func (z *SigSet) UnmarshalMsg(bts []byte) (o []byte, err error) {
    75  	var zb0001 uint32
    76  	zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
    77  	if err != nil {
    78  		err = msgp.WrapError(err)
    79  		return
    80  	}
    81  	if zb0001 != 2 {
    82  		err = msgp.ArrayError{Wanted: 2, Got: zb0001}
    83  		return
    84  	}
    85  	bts, err = z.PublicKey.UnmarshalMsg(bts)
    86  	if err != nil {
    87  		err = msgp.WrapError(err, "PublicKey")
    88  		return
    89  	}
    90  	bts, err = z.Signature.UnmarshalMsg(bts)
    91  	if err != nil {
    92  		err = msgp.WrapError(err, "Signature")
    93  		return
    94  	}
    95  	o = bts
    96  	return
    97  }
    98  
    99  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   100  func (z *SigSet) Msgsize() (s int) {
   101  	s = 1 + z.PublicKey.Msgsize() + z.Signature.Msgsize()
   102  	return
   103  }
   104  
   105  // DecodeMsg implements msgp.Decodable
   106  func (z *TermChange) DecodeMsg(dc *msgp.Reader) (err error) {
   107  	var zb0001 uint32
   108  	zb0001, err = dc.ReadArrayHeader()
   109  	if err != nil {
   110  		err = msgp.WrapError(err)
   111  		return
   112  	}
   113  	if zb0001 != 5 {
   114  		err = msgp.ArrayError{Wanted: 5, Got: zb0001}
   115  		return
   116  	}
   117  	err = z.TxBase.DecodeMsg(dc)
   118  	if err != nil {
   119  		err = msgp.WrapError(err, "TxBase")
   120  		return
   121  	}
   122  	z.TermID, err = dc.ReadUint64()
   123  	if err != nil {
   124  		err = msgp.WrapError(err, "TermID")
   125  		return
   126  	}
   127  	err = z.PkBls.DecodeMsg(dc)
   128  	if err != nil {
   129  		err = msgp.WrapError(err, "PkBls")
   130  		return
   131  	}
   132  	var zb0002 uint32
   133  	zb0002, err = dc.ReadArrayHeader()
   134  	if err != nil {
   135  		err = msgp.WrapError(err, "SigSet")
   136  		return
   137  	}
   138  	if cap(z.SigSet) >= int(zb0002) {
   139  		z.SigSet = (z.SigSet)[:zb0002]
   140  	} else {
   141  		z.SigSet = make([]*SigSet, zb0002)
   142  	}
   143  	for za0001 := range z.SigSet {
   144  		if dc.IsNil() {
   145  			err = dc.ReadNil()
   146  			if err != nil {
   147  				err = msgp.WrapError(err, "SigSet", za0001)
   148  				return
   149  			}
   150  			z.SigSet[za0001] = nil
   151  		} else {
   152  			if z.SigSet[za0001] == nil {
   153  				z.SigSet[za0001] = new(SigSet)
   154  			}
   155  			var zb0003 uint32
   156  			zb0003, err = dc.ReadArrayHeader()
   157  			if err != nil {
   158  				err = msgp.WrapError(err, "SigSet", za0001)
   159  				return
   160  			}
   161  			if zb0003 != 2 {
   162  				err = msgp.ArrayError{Wanted: 2, Got: zb0003}
   163  				return
   164  			}
   165  			err = z.SigSet[za0001].PublicKey.DecodeMsg(dc)
   166  			if err != nil {
   167  				err = msgp.WrapError(err, "SigSet", za0001, "PublicKey")
   168  				return
   169  			}
   170  			err = z.SigSet[za0001].Signature.DecodeMsg(dc)
   171  			if err != nil {
   172  				err = msgp.WrapError(err, "SigSet", za0001, "Signature")
   173  				return
   174  			}
   175  		}
   176  	}
   177  	if dc.IsNil() {
   178  		err = dc.ReadNil()
   179  		if err != nil {
   180  			err = msgp.WrapError(err, "Issuer")
   181  			return
   182  		}
   183  		z.Issuer = nil
   184  	} else {
   185  		if z.Issuer == nil {
   186  			z.Issuer = new(common.Address)
   187  		}
   188  		err = z.Issuer.DecodeMsg(dc)
   189  		if err != nil {
   190  			err = msgp.WrapError(err, "Issuer")
   191  			return
   192  		}
   193  	}
   194  	return
   195  }
   196  
   197  // EncodeMsg implements msgp.Encodable
   198  func (z *TermChange) EncodeMsg(en *msgp.Writer) (err error) {
   199  	// array header, size 5
   200  	err = en.Append(0x95)
   201  	if err != nil {
   202  		return
   203  	}
   204  	err = z.TxBase.EncodeMsg(en)
   205  	if err != nil {
   206  		err = msgp.WrapError(err, "TxBase")
   207  		return
   208  	}
   209  	err = en.WriteUint64(z.TermID)
   210  	if err != nil {
   211  		err = msgp.WrapError(err, "TermID")
   212  		return
   213  	}
   214  	err = z.PkBls.EncodeMsg(en)
   215  	if err != nil {
   216  		err = msgp.WrapError(err, "PkBls")
   217  		return
   218  	}
   219  	err = en.WriteArrayHeader(uint32(len(z.SigSet)))
   220  	if err != nil {
   221  		err = msgp.WrapError(err, "SigSet")
   222  		return
   223  	}
   224  	for za0001 := range z.SigSet {
   225  		if z.SigSet[za0001] == nil {
   226  			err = en.WriteNil()
   227  			if err != nil {
   228  				return
   229  			}
   230  		} else {
   231  			// array header, size 2
   232  			err = en.Append(0x92)
   233  			if err != nil {
   234  				return
   235  			}
   236  			err = z.SigSet[za0001].PublicKey.EncodeMsg(en)
   237  			if err != nil {
   238  				err = msgp.WrapError(err, "SigSet", za0001, "PublicKey")
   239  				return
   240  			}
   241  			err = z.SigSet[za0001].Signature.EncodeMsg(en)
   242  			if err != nil {
   243  				err = msgp.WrapError(err, "SigSet", za0001, "Signature")
   244  				return
   245  			}
   246  		}
   247  	}
   248  	if z.Issuer == nil {
   249  		err = en.WriteNil()
   250  		if err != nil {
   251  			return
   252  		}
   253  	} else {
   254  		err = z.Issuer.EncodeMsg(en)
   255  		if err != nil {
   256  			err = msgp.WrapError(err, "Issuer")
   257  			return
   258  		}
   259  	}
   260  	return
   261  }
   262  
   263  // MarshalMsg implements msgp.Marshaler
   264  func (z *TermChange) MarshalMsg(b []byte) (o []byte, err error) {
   265  	o = msgp.Require(b, z.Msgsize())
   266  	// array header, size 5
   267  	o = append(o, 0x95)
   268  	o, err = z.TxBase.MarshalMsg(o)
   269  	if err != nil {
   270  		err = msgp.WrapError(err, "TxBase")
   271  		return
   272  	}
   273  	o = msgp.AppendUint64(o, z.TermID)
   274  	o, err = z.PkBls.MarshalMsg(o)
   275  	if err != nil {
   276  		err = msgp.WrapError(err, "PkBls")
   277  		return
   278  	}
   279  	o = msgp.AppendArrayHeader(o, uint32(len(z.SigSet)))
   280  	for za0001 := range z.SigSet {
   281  		if z.SigSet[za0001] == nil {
   282  			o = msgp.AppendNil(o)
   283  		} else {
   284  			// array header, size 2
   285  			o = append(o, 0x92)
   286  			o, err = z.SigSet[za0001].PublicKey.MarshalMsg(o)
   287  			if err != nil {
   288  				err = msgp.WrapError(err, "SigSet", za0001, "PublicKey")
   289  				return
   290  			}
   291  			o, err = z.SigSet[za0001].Signature.MarshalMsg(o)
   292  			if err != nil {
   293  				err = msgp.WrapError(err, "SigSet", za0001, "Signature")
   294  				return
   295  			}
   296  		}
   297  	}
   298  	if z.Issuer == nil {
   299  		o = msgp.AppendNil(o)
   300  	} else {
   301  		o, err = z.Issuer.MarshalMsg(o)
   302  		if err != nil {
   303  			err = msgp.WrapError(err, "Issuer")
   304  			return
   305  		}
   306  	}
   307  	return
   308  }
   309  
   310  // UnmarshalMsg implements msgp.Unmarshaler
   311  func (z *TermChange) UnmarshalMsg(bts []byte) (o []byte, err error) {
   312  	var zb0001 uint32
   313  	zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
   314  	if err != nil {
   315  		err = msgp.WrapError(err)
   316  		return
   317  	}
   318  	if zb0001 != 5 {
   319  		err = msgp.ArrayError{Wanted: 5, Got: zb0001}
   320  		return
   321  	}
   322  	bts, err = z.TxBase.UnmarshalMsg(bts)
   323  	if err != nil {
   324  		err = msgp.WrapError(err, "TxBase")
   325  		return
   326  	}
   327  	z.TermID, bts, err = msgp.ReadUint64Bytes(bts)
   328  	if err != nil {
   329  		err = msgp.WrapError(err, "TermID")
   330  		return
   331  	}
   332  	bts, err = z.PkBls.UnmarshalMsg(bts)
   333  	if err != nil {
   334  		err = msgp.WrapError(err, "PkBls")
   335  		return
   336  	}
   337  	var zb0002 uint32
   338  	zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
   339  	if err != nil {
   340  		err = msgp.WrapError(err, "SigSet")
   341  		return
   342  	}
   343  	if cap(z.SigSet) >= int(zb0002) {
   344  		z.SigSet = (z.SigSet)[:zb0002]
   345  	} else {
   346  		z.SigSet = make([]*SigSet, zb0002)
   347  	}
   348  	for za0001 := range z.SigSet {
   349  		if msgp.IsNil(bts) {
   350  			bts, err = msgp.ReadNilBytes(bts)
   351  			if err != nil {
   352  				return
   353  			}
   354  			z.SigSet[za0001] = nil
   355  		} else {
   356  			if z.SigSet[za0001] == nil {
   357  				z.SigSet[za0001] = new(SigSet)
   358  			}
   359  			var zb0003 uint32
   360  			zb0003, bts, err = msgp.ReadArrayHeaderBytes(bts)
   361  			if err != nil {
   362  				err = msgp.WrapError(err, "SigSet", za0001)
   363  				return
   364  			}
   365  			if zb0003 != 2 {
   366  				err = msgp.ArrayError{Wanted: 2, Got: zb0003}
   367  				return
   368  			}
   369  			bts, err = z.SigSet[za0001].PublicKey.UnmarshalMsg(bts)
   370  			if err != nil {
   371  				err = msgp.WrapError(err, "SigSet", za0001, "PublicKey")
   372  				return
   373  			}
   374  			bts, err = z.SigSet[za0001].Signature.UnmarshalMsg(bts)
   375  			if err != nil {
   376  				err = msgp.WrapError(err, "SigSet", za0001, "Signature")
   377  				return
   378  			}
   379  		}
   380  	}
   381  	if msgp.IsNil(bts) {
   382  		bts, err = msgp.ReadNilBytes(bts)
   383  		if err != nil {
   384  			return
   385  		}
   386  		z.Issuer = nil
   387  	} else {
   388  		if z.Issuer == nil {
   389  			z.Issuer = new(common.Address)
   390  		}
   391  		bts, err = z.Issuer.UnmarshalMsg(bts)
   392  		if err != nil {
   393  			err = msgp.WrapError(err, "Issuer")
   394  			return
   395  		}
   396  	}
   397  	o = bts
   398  	return
   399  }
   400  
   401  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   402  func (z *TermChange) Msgsize() (s int) {
   403  	s = 1 + z.TxBase.Msgsize() + msgp.Uint64Size + z.PkBls.Msgsize() + msgp.ArrayHeaderSize
   404  	for za0001 := range z.SigSet {
   405  		if z.SigSet[za0001] == nil {
   406  			s += msgp.NilSize
   407  		} else {
   408  			s += 1 + z.SigSet[za0001].PublicKey.Msgsize() + z.SigSet[za0001].Signature.Msgsize()
   409  		}
   410  	}
   411  	if z.Issuer == nil {
   412  		s += msgp.NilSize
   413  	} else {
   414  		s += z.Issuer.Msgsize()
   415  	}
   416  	return
   417  }
   418  
   419  // DecodeMsg implements msgp.Decodable
   420  func (z *TermChanges) DecodeMsg(dc *msgp.Reader) (err error) {
   421  	var zb0002 uint32
   422  	zb0002, err = dc.ReadArrayHeader()
   423  	if err != nil {
   424  		err = msgp.WrapError(err)
   425  		return
   426  	}
   427  	if cap((*z)) >= int(zb0002) {
   428  		(*z) = (*z)[:zb0002]
   429  	} else {
   430  		(*z) = make(TermChanges, zb0002)
   431  	}
   432  	for zb0001 := range *z {
   433  		if dc.IsNil() {
   434  			err = dc.ReadNil()
   435  			if err != nil {
   436  				err = msgp.WrapError(err, zb0001)
   437  				return
   438  			}
   439  			(*z)[zb0001] = nil
   440  		} else {
   441  			if (*z)[zb0001] == nil {
   442  				(*z)[zb0001] = new(TermChange)
   443  			}
   444  			err = (*z)[zb0001].DecodeMsg(dc)
   445  			if err != nil {
   446  				err = msgp.WrapError(err, zb0001)
   447  				return
   448  			}
   449  		}
   450  	}
   451  	return
   452  }
   453  
   454  // EncodeMsg implements msgp.Encodable
   455  func (z TermChanges) EncodeMsg(en *msgp.Writer) (err error) {
   456  	err = en.WriteArrayHeader(uint32(len(z)))
   457  	if err != nil {
   458  		err = msgp.WrapError(err)
   459  		return
   460  	}
   461  	for zb0003 := range z {
   462  		if z[zb0003] == nil {
   463  			err = en.WriteNil()
   464  			if err != nil {
   465  				return
   466  			}
   467  		} else {
   468  			err = z[zb0003].EncodeMsg(en)
   469  			if err != nil {
   470  				err = msgp.WrapError(err, zb0003)
   471  				return
   472  			}
   473  		}
   474  	}
   475  	return
   476  }
   477  
   478  // MarshalMsg implements msgp.Marshaler
   479  func (z TermChanges) MarshalMsg(b []byte) (o []byte, err error) {
   480  	o = msgp.Require(b, z.Msgsize())
   481  	o = msgp.AppendArrayHeader(o, uint32(len(z)))
   482  	for zb0003 := range z {
   483  		if z[zb0003] == nil {
   484  			o = msgp.AppendNil(o)
   485  		} else {
   486  			o, err = z[zb0003].MarshalMsg(o)
   487  			if err != nil {
   488  				err = msgp.WrapError(err, zb0003)
   489  				return
   490  			}
   491  		}
   492  	}
   493  	return
   494  }
   495  
   496  // UnmarshalMsg implements msgp.Unmarshaler
   497  func (z *TermChanges) UnmarshalMsg(bts []byte) (o []byte, err error) {
   498  	var zb0002 uint32
   499  	zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
   500  	if err != nil {
   501  		err = msgp.WrapError(err)
   502  		return
   503  	}
   504  	if cap((*z)) >= int(zb0002) {
   505  		(*z) = (*z)[:zb0002]
   506  	} else {
   507  		(*z) = make(TermChanges, zb0002)
   508  	}
   509  	for zb0001 := range *z {
   510  		if msgp.IsNil(bts) {
   511  			bts, err = msgp.ReadNilBytes(bts)
   512  			if err != nil {
   513  				return
   514  			}
   515  			(*z)[zb0001] = nil
   516  		} else {
   517  			if (*z)[zb0001] == nil {
   518  				(*z)[zb0001] = new(TermChange)
   519  			}
   520  			bts, err = (*z)[zb0001].UnmarshalMsg(bts)
   521  			if err != nil {
   522  				err = msgp.WrapError(err, zb0001)
   523  				return
   524  			}
   525  		}
   526  	}
   527  	o = bts
   528  	return
   529  }
   530  
   531  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   532  func (z TermChanges) Msgsize() (s int) {
   533  	s = msgp.ArrayHeaderSize
   534  	for zb0003 := range z {
   535  		if z[zb0003] == nil {
   536  			s += msgp.NilSize
   537  		} else {
   538  			s += z[zb0003].Msgsize()
   539  		}
   540  	}
   541  	return
   542  }