github.com/annchain/OG@v0.0.9/og/protocol/ogmessage/archive/txbase_gen.go (about) 1 package archive 2 3 // Code generated by github.com/tinylib/msgp DO NOT EDIT. 4 5 import ( 6 "github.com/tinylib/msgp/msgp" 7 ) 8 9 // DecodeMsg implements msgp.Decodable 10 func (z *TxBase) DecodeMsg(dc *msgp.Reader) (err error) { 11 var zb0001 uint32 12 zb0001, err = dc.ReadArrayHeader() 13 if err != nil { 14 return 15 } 16 if zb0001 != 10 { 17 err = msgp.ArrayError{Wanted: 10, Got: zb0001} 18 return 19 } 20 { 21 var zb0002 uint16 22 zb0002, err = dc.ReadUint16() 23 if err != nil { 24 return 25 } 26 z.Type = TxBaseType(zb0002) 27 } 28 err = z.Hash.DecodeMsg(dc) 29 if err != nil { 30 return 31 } 32 err = z.ParentsHash.DecodeMsg(dc) 33 if err != nil { 34 return 35 } 36 z.AccountNonce, err = dc.ReadUint64() 37 if err != nil { 38 return 39 } 40 z.Height, err = dc.ReadUint64() 41 if err != nil { 42 return 43 } 44 err = z.PublicKey.DecodeMsg(dc) 45 if err != nil { 46 return 47 } 48 err = z.Signature.DecodeMsg(dc) 49 if err != nil { 50 return 51 } 52 z.MineNonce, err = dc.ReadUint64() 53 if err != nil { 54 return 55 } 56 z.Weight, err = dc.ReadUint64() 57 if err != nil { 58 return 59 } 60 z.Version, err = dc.ReadByte() 61 if err != nil { 62 return 63 } 64 return 65 } 66 67 // EncodeMsg implements msgp.Encodable 68 func (z *TxBase) EncodeMsg(en *msgp.Writer) (err error) { 69 // array header, size 10 70 err = en.Append(0x9a) 71 if err != nil { 72 return 73 } 74 err = en.WriteUint16(uint16(z.Type)) 75 if err != nil { 76 return 77 } 78 err = z.Hash.EncodeMsg(en) 79 if err != nil { 80 return 81 } 82 err = z.ParentsHash.EncodeMsg(en) 83 if err != nil { 84 return 85 } 86 err = en.WriteUint64(z.AccountNonce) 87 if err != nil { 88 return 89 } 90 err = en.WriteUint64(z.Height) 91 if err != nil { 92 return 93 } 94 err = z.PublicKey.EncodeMsg(en) 95 if err != nil { 96 return 97 } 98 err = z.Signature.EncodeMsg(en) 99 if err != nil { 100 return 101 } 102 err = en.WriteUint64(z.MineNonce) 103 if err != nil { 104 return 105 } 106 err = en.WriteUint64(z.Weight) 107 if err != nil { 108 return 109 } 110 err = en.WriteByte(z.Version) 111 if err != nil { 112 return 113 } 114 return 115 } 116 117 // MarshalMsg implements msgp.Marshaler 118 func (z *TxBase) MarshalMsg(b []byte) (o []byte, err error) { 119 o = msgp.Require(b, z.Msgsize()) 120 // array header, size 10 121 o = append(o, 0x9a) 122 o = msgp.AppendUint16(o, uint16(z.Type)) 123 o, err = z.Hash.MarshalMsg(o) 124 if err != nil { 125 return 126 } 127 o, err = z.ParentsHash.MarshalMsg(o) 128 if err != nil { 129 return 130 } 131 o = msgp.AppendUint64(o, z.AccountNonce) 132 o = msgp.AppendUint64(o, z.Height) 133 o, err = z.PublicKey.MarshalMsg(o) 134 if err != nil { 135 return 136 } 137 o, err = z.Signature.MarshalMsg(o) 138 if err != nil { 139 return 140 } 141 o = msgp.AppendUint64(o, z.MineNonce) 142 o = msgp.AppendUint64(o, z.Weight) 143 o = msgp.AppendByte(o, z.Version) 144 return 145 } 146 147 // UnmarshalMsg implements msgp.Unmarshaler 148 func (z *TxBase) UnmarshalMsg(bts []byte) (o []byte, err error) { 149 var zb0001 uint32 150 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 151 if err != nil { 152 return 153 } 154 if zb0001 != 10 { 155 err = msgp.ArrayError{Wanted: 10, Got: zb0001} 156 return 157 } 158 { 159 var zb0002 uint16 160 zb0002, bts, err = msgp.ReadUint16Bytes(bts) 161 if err != nil { 162 return 163 } 164 z.Type = TxBaseType(zb0002) 165 } 166 bts, err = z.Hash.UnmarshalMsg(bts) 167 if err != nil { 168 return 169 } 170 bts, err = z.ParentsHash.UnmarshalMsg(bts) 171 if err != nil { 172 return 173 } 174 z.AccountNonce, bts, err = msgp.ReadUint64Bytes(bts) 175 if err != nil { 176 return 177 } 178 z.Height, bts, err = msgp.ReadUint64Bytes(bts) 179 if err != nil { 180 return 181 } 182 bts, err = z.PublicKey.UnmarshalMsg(bts) 183 if err != nil { 184 return 185 } 186 bts, err = z.Signature.UnmarshalMsg(bts) 187 if err != nil { 188 return 189 } 190 z.MineNonce, bts, err = msgp.ReadUint64Bytes(bts) 191 if err != nil { 192 return 193 } 194 z.Weight, bts, err = msgp.ReadUint64Bytes(bts) 195 if err != nil { 196 return 197 } 198 z.Version, bts, err = msgp.ReadByteBytes(bts) 199 if err != nil { 200 return 201 } 202 o = bts 203 return 204 } 205 206 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 207 func (z *TxBase) Msgsize() (s int) { 208 s = 1 + msgp.Uint16Size + z.Hash.Msgsize() + z.ParentsHash.Msgsize() + msgp.Uint64Size + msgp.Uint64Size + z.PublicKey.Msgsize() + z.Signature.Msgsize() + msgp.Uint64Size + msgp.Uint64Size + msgp.ByteSize 209 return 210 } 211 212 // DecodeMsg implements msgp.Decodable 213 func (z *TxBaseJson) DecodeMsg(dc *msgp.Reader) (err error) { 214 var zb0001 uint32 215 zb0001, err = dc.ReadArrayHeader() 216 if err != nil { 217 return 218 } 219 if zb0001 != 10 { 220 err = msgp.ArrayError{Wanted: 10, Got: zb0001} 221 return 222 } 223 { 224 var zb0002 uint16 225 zb0002, err = dc.ReadUint16() 226 if err != nil { 227 return 228 } 229 z.Type = TxBaseType(zb0002) 230 } 231 err = z.Hash.DecodeMsg(dc) 232 if err != nil { 233 return 234 } 235 err = z.ParentsHash.DecodeMsg(dc) 236 if err != nil { 237 return 238 } 239 z.AccountNonce, err = dc.ReadUint64() 240 if err != nil { 241 return 242 } 243 z.Height, err = dc.ReadUint64() 244 if err != nil { 245 return 246 } 247 err = z.PublicKey.DecodeMsg(dc) 248 if err != nil { 249 return 250 } 251 err = z.Signature.DecodeMsg(dc) 252 if err != nil { 253 return 254 } 255 z.MineNonce, err = dc.ReadUint64() 256 if err != nil { 257 return 258 } 259 z.Weight, err = dc.ReadUint64() 260 if err != nil { 261 return 262 } 263 z.Version, err = dc.ReadByte() 264 if err != nil { 265 return 266 } 267 return 268 } 269 270 // EncodeMsg implements msgp.Encodable 271 func (z *TxBaseJson) EncodeMsg(en *msgp.Writer) (err error) { 272 // array header, size 10 273 err = en.Append(0x9a) 274 if err != nil { 275 return 276 } 277 err = en.WriteUint16(uint16(z.Type)) 278 if err != nil { 279 return 280 } 281 err = z.Hash.EncodeMsg(en) 282 if err != nil { 283 return 284 } 285 err = z.ParentsHash.EncodeMsg(en) 286 if err != nil { 287 return 288 } 289 err = en.WriteUint64(z.AccountNonce) 290 if err != nil { 291 return 292 } 293 err = en.WriteUint64(z.Height) 294 if err != nil { 295 return 296 } 297 err = z.PublicKey.EncodeMsg(en) 298 if err != nil { 299 return 300 } 301 err = z.Signature.EncodeMsg(en) 302 if err != nil { 303 return 304 } 305 err = en.WriteUint64(z.MineNonce) 306 if err != nil { 307 return 308 } 309 err = en.WriteUint64(z.Weight) 310 if err != nil { 311 return 312 } 313 err = en.WriteByte(z.Version) 314 if err != nil { 315 return 316 } 317 return 318 } 319 320 // MarshalMsg implements msgp.Marshaler 321 func (z *TxBaseJson) MarshalMsg(b []byte) (o []byte, err error) { 322 o = msgp.Require(b, z.Msgsize()) 323 // array header, size 10 324 o = append(o, 0x9a) 325 o = msgp.AppendUint16(o, uint16(z.Type)) 326 o, err = z.Hash.MarshalMsg(o) 327 if err != nil { 328 return 329 } 330 o, err = z.ParentsHash.MarshalMsg(o) 331 if err != nil { 332 return 333 } 334 o = msgp.AppendUint64(o, z.AccountNonce) 335 o = msgp.AppendUint64(o, z.Height) 336 o, err = z.PublicKey.MarshalMsg(o) 337 if err != nil { 338 return 339 } 340 o, err = z.Signature.MarshalMsg(o) 341 if err != nil { 342 return 343 } 344 o = msgp.AppendUint64(o, z.MineNonce) 345 o = msgp.AppendUint64(o, z.Weight) 346 o = msgp.AppendByte(o, z.Version) 347 return 348 } 349 350 // UnmarshalMsg implements msgp.Unmarshaler 351 func (z *TxBaseJson) UnmarshalMsg(bts []byte) (o []byte, err error) { 352 var zb0001 uint32 353 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 354 if err != nil { 355 return 356 } 357 if zb0001 != 10 { 358 err = msgp.ArrayError{Wanted: 10, Got: zb0001} 359 return 360 } 361 { 362 var zb0002 uint16 363 zb0002, bts, err = msgp.ReadUint16Bytes(bts) 364 if err != nil { 365 return 366 } 367 z.Type = TxBaseType(zb0002) 368 } 369 bts, err = z.Hash.UnmarshalMsg(bts) 370 if err != nil { 371 return 372 } 373 bts, err = z.ParentsHash.UnmarshalMsg(bts) 374 if err != nil { 375 return 376 } 377 z.AccountNonce, bts, err = msgp.ReadUint64Bytes(bts) 378 if err != nil { 379 return 380 } 381 z.Height, bts, err = msgp.ReadUint64Bytes(bts) 382 if err != nil { 383 return 384 } 385 bts, err = z.PublicKey.UnmarshalMsg(bts) 386 if err != nil { 387 return 388 } 389 bts, err = z.Signature.UnmarshalMsg(bts) 390 if err != nil { 391 return 392 } 393 z.MineNonce, bts, err = msgp.ReadUint64Bytes(bts) 394 if err != nil { 395 return 396 } 397 z.Weight, bts, err = msgp.ReadUint64Bytes(bts) 398 if err != nil { 399 return 400 } 401 z.Version, bts, err = msgp.ReadByteBytes(bts) 402 if err != nil { 403 return 404 } 405 o = bts 406 return 407 } 408 409 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 410 func (z *TxBaseJson) Msgsize() (s int) { 411 s = 1 + msgp.Uint16Size + z.Hash.Msgsize() + z.ParentsHash.Msgsize() + msgp.Uint64Size + msgp.Uint64Size + z.PublicKey.Msgsize() + z.Signature.Msgsize() + msgp.Uint64Size + msgp.Uint64Size + msgp.ByteSize 412 return 413 } 414 415 // DecodeMsg implements msgp.Decodable 416 func (z *TxBaseType) DecodeMsg(dc *msgp.Reader) (err error) { 417 { 418 var zb0001 uint16 419 zb0001, err = dc.ReadUint16() 420 if err != nil { 421 return 422 } 423 (*z) = TxBaseType(zb0001) 424 } 425 return 426 } 427 428 // EncodeMsg implements msgp.Encodable 429 func (z TxBaseType) EncodeMsg(en *msgp.Writer) (err error) { 430 err = en.WriteUint16(uint16(z)) 431 if err != nil { 432 return 433 } 434 return 435 } 436 437 // MarshalMsg implements msgp.Marshaler 438 func (z TxBaseType) MarshalMsg(b []byte) (o []byte, err error) { 439 o = msgp.Require(b, z.Msgsize()) 440 o = msgp.AppendUint16(o, uint16(z)) 441 return 442 } 443 444 // UnmarshalMsg implements msgp.Unmarshaler 445 func (z *TxBaseType) UnmarshalMsg(bts []byte) (o []byte, err error) { 446 { 447 var zb0001 uint16 448 zb0001, bts, err = msgp.ReadUint16Bytes(bts) 449 if err != nil { 450 return 451 } 452 (*z) = TxBaseType(zb0001) 453 } 454 o = bts 455 return 456 } 457 458 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 459 func (z TxBaseType) Msgsize() (s int) { 460 s = msgp.Uint16Size 461 return 462 }