github.com/annchain/OG@v0.0.9/consensus/bft/message_gen.go (about) 1 package bft 2 3 // Code generated by github.com/tinylib/msgp DO NOT EDIT. 4 5 import ( 6 "github.com/annchain/OG/arefactor/og/types" 7 "github.com/tinylib/msgp/msgp" 8 ) 9 10 // DecodeMsg implements msgp.Decodable 11 func (z *BftBasicInfo) 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 != 3 { 19 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 20 return 21 } 22 z.SourceId, err = dc.ReadUint16() 23 if err != nil { 24 err = msgp.WrapError(err, "SourceId") 25 return 26 } 27 var zb0002 uint32 28 zb0002, err = dc.ReadArrayHeader() 29 if err != nil { 30 err = msgp.WrapError(err, "HeightRound") 31 return 32 } 33 if zb0002 != 2 { 34 err = msgp.ArrayError{Wanted: 2, Got: zb0002} 35 return 36 } 37 z.HeightRound.Height, err = dc.ReadUint64() 38 if err != nil { 39 err = msgp.WrapError(err, "HeightRound", "Height") 40 return 41 } 42 z.HeightRound.Round, err = dc.ReadInt() 43 if err != nil { 44 err = msgp.WrapError(err, "HeightRound", "Round") 45 return 46 } 47 err = z.PublicKeyBytes.DecodeMsg(dc) 48 if err != nil { 49 err = msgp.WrapError(err, "PublicKeyBytes") 50 return 51 } 52 return 53 } 54 55 // EncodeMsg implements msgp.Encodable 56 func (z *BftBasicInfo) EncodeMsg(en *msgp.Writer) (err error) { 57 // array header, size 3 58 err = en.Append(0x93) 59 if err != nil { 60 return 61 } 62 err = en.WriteUint16(z.SourceId) 63 if err != nil { 64 err = msgp.WrapError(err, "SourceId") 65 return 66 } 67 // array header, size 2 68 err = en.Append(0x92) 69 if err != nil { 70 return 71 } 72 err = en.WriteUint64(z.HeightRound.Height) 73 if err != nil { 74 err = msgp.WrapError(err, "HeightRound", "Height") 75 return 76 } 77 err = en.WriteInt(z.HeightRound.Round) 78 if err != nil { 79 err = msgp.WrapError(err, "HeightRound", "Round") 80 return 81 } 82 err = z.PublicKeyBytes.EncodeMsg(en) 83 if err != nil { 84 err = msgp.WrapError(err, "PublicKeyBytes") 85 return 86 } 87 return 88 } 89 90 // MarshalMsg implements msgp.Marshaler 91 func (z *BftBasicInfo) MarshalMsg(b []byte) (o []byte, err error) { 92 o = msgp.Require(b, z.Msgsize()) 93 // array header, size 3 94 o = append(o, 0x93) 95 o = msgp.AppendUint16(o, z.SourceId) 96 // array header, size 2 97 o = append(o, 0x92) 98 o = msgp.AppendUint64(o, z.HeightRound.Height) 99 o = msgp.AppendInt(o, z.HeightRound.Round) 100 o, err = z.PublicKeyBytes.MarshalMsg(o) 101 if err != nil { 102 err = msgp.WrapError(err, "PublicKeyBytes") 103 return 104 } 105 return 106 } 107 108 // UnmarshalMsg implements msgp.Unmarshaler 109 func (z *BftBasicInfo) UnmarshalMsg(bts []byte) (o []byte, err error) { 110 var zb0001 uint32 111 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 112 if err != nil { 113 err = msgp.WrapError(err) 114 return 115 } 116 if zb0001 != 3 { 117 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 118 return 119 } 120 z.SourceId, bts, err = msgp.ReadUint16Bytes(bts) 121 if err != nil { 122 err = msgp.WrapError(err, "SourceId") 123 return 124 } 125 var zb0002 uint32 126 zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts) 127 if err != nil { 128 err = msgp.WrapError(err, "HeightRound") 129 return 130 } 131 if zb0002 != 2 { 132 err = msgp.ArrayError{Wanted: 2, Got: zb0002} 133 return 134 } 135 z.HeightRound.Height, bts, err = msgp.ReadUint64Bytes(bts) 136 if err != nil { 137 err = msgp.WrapError(err, "HeightRound", "Height") 138 return 139 } 140 z.HeightRound.Round, bts, err = msgp.ReadIntBytes(bts) 141 if err != nil { 142 err = msgp.WrapError(err, "HeightRound", "Round") 143 return 144 } 145 bts, err = z.PublicKeyBytes.UnmarshalMsg(bts) 146 if err != nil { 147 err = msgp.WrapError(err, "PublicKeyBytes") 148 return 149 } 150 o = bts 151 return 152 } 153 154 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 155 func (z *BftBasicInfo) Msgsize() (s int) { 156 s = 1 + msgp.Uint16Size + 1 + msgp.Uint64Size + msgp.IntSize + z.PublicKeyBytes.Msgsize() 157 return 158 } 159 160 // DecodeMsg implements msgp.Decodable 161 func (z *BftMessagePreCommit) DecodeMsg(dc *msgp.Reader) (err error) { 162 var zb0001 uint32 163 zb0001, err = dc.ReadArrayHeader() 164 if err != nil { 165 err = msgp.WrapError(err) 166 return 167 } 168 if zb0001 != 3 { 169 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 170 return 171 } 172 err = z.BftBasicInfo.DecodeMsg(dc) 173 if err != nil { 174 err = msgp.WrapError(err, "BftBasicInfo") 175 return 176 } 177 if dc.IsNil() { 178 err = dc.ReadNil() 179 if err != nil { 180 err = msgp.WrapError(err, "Idv") 181 return 182 } 183 z.Idv = nil 184 } else { 185 if z.Idv == nil { 186 z.Idv = new(types.Hash) 187 } 188 err = z.Idv.DecodeMsg(dc) 189 if err != nil { 190 err = msgp.WrapError(err, "Idv") 191 return 192 } 193 } 194 err = z.BlsSignature.DecodeMsg(dc) 195 if err != nil { 196 err = msgp.WrapError(err, "BlsSignature") 197 return 198 } 199 return 200 } 201 202 // EncodeMsg implements msgp.Encodable 203 func (z *BftMessagePreCommit) EncodeMsg(en *msgp.Writer) (err error) { 204 // array header, size 3 205 err = en.Append(0x93) 206 if err != nil { 207 return 208 } 209 err = z.BftBasicInfo.EncodeMsg(en) 210 if err != nil { 211 err = msgp.WrapError(err, "BftBasicInfo") 212 return 213 } 214 if z.Idv == nil { 215 err = en.WriteNil() 216 if err != nil { 217 return 218 } 219 } else { 220 err = z.Idv.EncodeMsg(en) 221 if err != nil { 222 err = msgp.WrapError(err, "Idv") 223 return 224 } 225 } 226 err = z.BlsSignature.EncodeMsg(en) 227 if err != nil { 228 err = msgp.WrapError(err, "BlsSignature") 229 return 230 } 231 return 232 } 233 234 // MarshalMsg implements msgp.Marshaler 235 func (z *BftMessagePreCommit) MarshalMsg(b []byte) (o []byte, err error) { 236 o = msgp.Require(b, z.Msgsize()) 237 // array header, size 3 238 o = append(o, 0x93) 239 o, err = z.BftBasicInfo.MarshalMsg(o) 240 if err != nil { 241 err = msgp.WrapError(err, "BftBasicInfo") 242 return 243 } 244 if z.Idv == nil { 245 o = msgp.AppendNil(o) 246 } else { 247 o, err = z.Idv.MarshalMsg(o) 248 if err != nil { 249 err = msgp.WrapError(err, "Idv") 250 return 251 } 252 } 253 o, err = z.BlsSignature.MarshalMsg(o) 254 if err != nil { 255 err = msgp.WrapError(err, "BlsSignature") 256 return 257 } 258 return 259 } 260 261 // UnmarshalMsg implements msgp.Unmarshaler 262 func (z *BftMessagePreCommit) UnmarshalMsg(bts []byte) (o []byte, err error) { 263 var zb0001 uint32 264 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 265 if err != nil { 266 err = msgp.WrapError(err) 267 return 268 } 269 if zb0001 != 3 { 270 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 271 return 272 } 273 bts, err = z.BftBasicInfo.UnmarshalMsg(bts) 274 if err != nil { 275 err = msgp.WrapError(err, "BftBasicInfo") 276 return 277 } 278 if msgp.IsNil(bts) { 279 bts, err = msgp.ReadNilBytes(bts) 280 if err != nil { 281 return 282 } 283 z.Idv = nil 284 } else { 285 if z.Idv == nil { 286 z.Idv = new(types.Hash) 287 } 288 bts, err = z.Idv.UnmarshalMsg(bts) 289 if err != nil { 290 err = msgp.WrapError(err, "Idv") 291 return 292 } 293 } 294 bts, err = z.BlsSignature.UnmarshalMsg(bts) 295 if err != nil { 296 err = msgp.WrapError(err, "BlsSignature") 297 return 298 } 299 o = bts 300 return 301 } 302 303 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 304 func (z *BftMessagePreCommit) Msgsize() (s int) { 305 s = 1 + z.BftBasicInfo.Msgsize() 306 if z.Idv == nil { 307 s += msgp.NilSize 308 } else { 309 s += z.Idv.Msgsize() 310 } 311 s += z.BlsSignature.Msgsize() 312 return 313 } 314 315 // DecodeMsg implements msgp.Decodable 316 func (z *BftMessagePreVote) DecodeMsg(dc *msgp.Reader) (err error) { 317 var zb0001 uint32 318 zb0001, err = dc.ReadArrayHeader() 319 if err != nil { 320 err = msgp.WrapError(err) 321 return 322 } 323 if zb0001 != 2 { 324 err = msgp.ArrayError{Wanted: 2, Got: zb0001} 325 return 326 } 327 err = z.BftBasicInfo.DecodeMsg(dc) 328 if err != nil { 329 err = msgp.WrapError(err, "BftBasicInfo") 330 return 331 } 332 if dc.IsNil() { 333 err = dc.ReadNil() 334 if err != nil { 335 err = msgp.WrapError(err, "Idv") 336 return 337 } 338 z.Idv = nil 339 } else { 340 if z.Idv == nil { 341 z.Idv = new(types.Hash) 342 } 343 err = z.Idv.DecodeMsg(dc) 344 if err != nil { 345 err = msgp.WrapError(err, "Idv") 346 return 347 } 348 } 349 return 350 } 351 352 // EncodeMsg implements msgp.Encodable 353 func (z *BftMessagePreVote) EncodeMsg(en *msgp.Writer) (err error) { 354 // array header, size 2 355 err = en.Append(0x92) 356 if err != nil { 357 return 358 } 359 err = z.BftBasicInfo.EncodeMsg(en) 360 if err != nil { 361 err = msgp.WrapError(err, "BftBasicInfo") 362 return 363 } 364 if z.Idv == nil { 365 err = en.WriteNil() 366 if err != nil { 367 return 368 } 369 } else { 370 err = z.Idv.EncodeMsg(en) 371 if err != nil { 372 err = msgp.WrapError(err, "Idv") 373 return 374 } 375 } 376 return 377 } 378 379 // MarshalMsg implements msgp.Marshaler 380 func (z *BftMessagePreVote) MarshalMsg(b []byte) (o []byte, err error) { 381 o = msgp.Require(b, z.Msgsize()) 382 // array header, size 2 383 o = append(o, 0x92) 384 o, err = z.BftBasicInfo.MarshalMsg(o) 385 if err != nil { 386 err = msgp.WrapError(err, "BftBasicInfo") 387 return 388 } 389 if z.Idv == nil { 390 o = msgp.AppendNil(o) 391 } else { 392 o, err = z.Idv.MarshalMsg(o) 393 if err != nil { 394 err = msgp.WrapError(err, "Idv") 395 return 396 } 397 } 398 return 399 } 400 401 // UnmarshalMsg implements msgp.Unmarshaler 402 func (z *BftMessagePreVote) UnmarshalMsg(bts []byte) (o []byte, err error) { 403 var zb0001 uint32 404 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 405 if err != nil { 406 err = msgp.WrapError(err) 407 return 408 } 409 if zb0001 != 2 { 410 err = msgp.ArrayError{Wanted: 2, Got: zb0001} 411 return 412 } 413 bts, err = z.BftBasicInfo.UnmarshalMsg(bts) 414 if err != nil { 415 err = msgp.WrapError(err, "BftBasicInfo") 416 return 417 } 418 if msgp.IsNil(bts) { 419 bts, err = msgp.ReadNilBytes(bts) 420 if err != nil { 421 return 422 } 423 z.Idv = nil 424 } else { 425 if z.Idv == nil { 426 z.Idv = new(types.Hash) 427 } 428 bts, err = z.Idv.UnmarshalMsg(bts) 429 if err != nil { 430 err = msgp.WrapError(err, "Idv") 431 return 432 } 433 } 434 o = bts 435 return 436 } 437 438 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 439 func (z *BftMessagePreVote) Msgsize() (s int) { 440 s = 1 + z.BftBasicInfo.Msgsize() 441 if z.Idv == nil { 442 s += msgp.NilSize 443 } else { 444 s += z.Idv.Msgsize() 445 } 446 return 447 } 448 449 // DecodeMsg implements msgp.Decodable 450 func (z *BftMessageProposal) DecodeMsg(dc *msgp.Reader) (err error) { 451 var zb0001 uint32 452 zb0001, err = dc.ReadArrayHeader() 453 if err != nil { 454 err = msgp.WrapError(err) 455 return 456 } 457 if zb0001 != 3 { 458 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 459 return 460 } 461 err = z.BftBasicInfo.DecodeMsg(dc) 462 if err != nil { 463 err = msgp.WrapError(err, "BftBasicInfo") 464 return 465 } 466 err = z.Value.DecodeMsg(dc) 467 if err != nil { 468 err = msgp.WrapError(err, "Value") 469 return 470 } 471 z.ValidRound, err = dc.ReadInt() 472 if err != nil { 473 err = msgp.WrapError(err, "ValidRound") 474 return 475 } 476 return 477 } 478 479 // EncodeMsg implements msgp.Encodable 480 func (z *BftMessageProposal) EncodeMsg(en *msgp.Writer) (err error) { 481 // array header, size 3 482 err = en.Append(0x93) 483 if err != nil { 484 return 485 } 486 err = z.BftBasicInfo.EncodeMsg(en) 487 if err != nil { 488 err = msgp.WrapError(err, "BftBasicInfo") 489 return 490 } 491 err = z.Value.EncodeMsg(en) 492 if err != nil { 493 err = msgp.WrapError(err, "Value") 494 return 495 } 496 err = en.WriteInt(z.ValidRound) 497 if err != nil { 498 err = msgp.WrapError(err, "ValidRound") 499 return 500 } 501 return 502 } 503 504 // MarshalMsg implements msgp.Marshaler 505 func (z *BftMessageProposal) MarshalMsg(b []byte) (o []byte, err error) { 506 o = msgp.Require(b, z.Msgsize()) 507 // array header, size 3 508 o = append(o, 0x93) 509 o, err = z.BftBasicInfo.MarshalMsg(o) 510 if err != nil { 511 err = msgp.WrapError(err, "BftBasicInfo") 512 return 513 } 514 o, err = z.Value.MarshalMsg(o) 515 if err != nil { 516 err = msgp.WrapError(err, "Value") 517 return 518 } 519 o = msgp.AppendInt(o, z.ValidRound) 520 return 521 } 522 523 // UnmarshalMsg implements msgp.Unmarshaler 524 func (z *BftMessageProposal) UnmarshalMsg(bts []byte) (o []byte, err error) { 525 var zb0001 uint32 526 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 527 if err != nil { 528 err = msgp.WrapError(err) 529 return 530 } 531 if zb0001 != 3 { 532 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 533 return 534 } 535 bts, err = z.BftBasicInfo.UnmarshalMsg(bts) 536 if err != nil { 537 err = msgp.WrapError(err, "BftBasicInfo") 538 return 539 } 540 bts, err = z.Value.UnmarshalMsg(bts) 541 if err != nil { 542 err = msgp.WrapError(err, "Value") 543 return 544 } 545 z.ValidRound, bts, err = msgp.ReadIntBytes(bts) 546 if err != nil { 547 err = msgp.WrapError(err, "ValidRound") 548 return 549 } 550 o = bts 551 return 552 } 553 554 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 555 func (z *BftMessageProposal) Msgsize() (s int) { 556 s = 1 + z.BftBasicInfo.Msgsize() + z.Value.Msgsize() + msgp.IntSize 557 return 558 } 559 560 // DecodeMsg implements msgp.Decodable 561 func (z *BftMessageType) DecodeMsg(dc *msgp.Reader) (err error) { 562 { 563 var zb0001 uint16 564 zb0001, err = dc.ReadUint16() 565 if err != nil { 566 err = msgp.WrapError(err) 567 return 568 } 569 (*z) = BftMessageType(zb0001) 570 } 571 return 572 } 573 574 // EncodeMsg implements msgp.Encodable 575 func (z BftMessageType) EncodeMsg(en *msgp.Writer) (err error) { 576 err = en.WriteUint16(uint16(z)) 577 if err != nil { 578 err = msgp.WrapError(err) 579 return 580 } 581 return 582 } 583 584 // MarshalMsg implements msgp.Marshaler 585 func (z BftMessageType) MarshalMsg(b []byte) (o []byte, err error) { 586 o = msgp.Require(b, z.Msgsize()) 587 o = msgp.AppendUint16(o, uint16(z)) 588 return 589 } 590 591 // UnmarshalMsg implements msgp.Unmarshaler 592 func (z *BftMessageType) UnmarshalMsg(bts []byte) (o []byte, err error) { 593 { 594 var zb0001 uint16 595 zb0001, bts, err = msgp.ReadUint16Bytes(bts) 596 if err != nil { 597 err = msgp.WrapError(err) 598 return 599 } 600 (*z) = BftMessageType(zb0001) 601 } 602 o = bts 603 return 604 } 605 606 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 607 func (z BftMessageType) Msgsize() (s int) { 608 s = msgp.Uint16Size 609 return 610 } 611 612 // DecodeMsg implements msgp.Decodable 613 func (z *HeightRound) DecodeMsg(dc *msgp.Reader) (err error) { 614 var zb0001 uint32 615 zb0001, err = dc.ReadArrayHeader() 616 if err != nil { 617 err = msgp.WrapError(err) 618 return 619 } 620 if zb0001 != 2 { 621 err = msgp.ArrayError{Wanted: 2, Got: zb0001} 622 return 623 } 624 z.Height, err = dc.ReadUint64() 625 if err != nil { 626 err = msgp.WrapError(err, "Height") 627 return 628 } 629 z.Round, err = dc.ReadInt() 630 if err != nil { 631 err = msgp.WrapError(err, "Round") 632 return 633 } 634 return 635 } 636 637 // EncodeMsg implements msgp.Encodable 638 func (z HeightRound) EncodeMsg(en *msgp.Writer) (err error) { 639 // array header, size 2 640 err = en.Append(0x92) 641 if err != nil { 642 return 643 } 644 err = en.WriteUint64(z.Height) 645 if err != nil { 646 err = msgp.WrapError(err, "Height") 647 return 648 } 649 err = en.WriteInt(z.Round) 650 if err != nil { 651 err = msgp.WrapError(err, "Round") 652 return 653 } 654 return 655 } 656 657 // MarshalMsg implements msgp.Marshaler 658 func (z HeightRound) MarshalMsg(b []byte) (o []byte, err error) { 659 o = msgp.Require(b, z.Msgsize()) 660 // array header, size 2 661 o = append(o, 0x92) 662 o = msgp.AppendUint64(o, z.Height) 663 o = msgp.AppendInt(o, z.Round) 664 return 665 } 666 667 // UnmarshalMsg implements msgp.Unmarshaler 668 func (z *HeightRound) UnmarshalMsg(bts []byte) (o []byte, err error) { 669 var zb0001 uint32 670 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 671 if err != nil { 672 err = msgp.WrapError(err) 673 return 674 } 675 if zb0001 != 2 { 676 err = msgp.ArrayError{Wanted: 2, Got: zb0001} 677 return 678 } 679 z.Height, bts, err = msgp.ReadUint64Bytes(bts) 680 if err != nil { 681 err = msgp.WrapError(err, "Height") 682 return 683 } 684 z.Round, bts, err = msgp.ReadIntBytes(bts) 685 if err != nil { 686 err = msgp.WrapError(err, "Round") 687 return 688 } 689 o = bts 690 return 691 } 692 693 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 694 func (z HeightRound) Msgsize() (s int) { 695 s = 1 + msgp.Uint64Size + msgp.IntSize 696 return 697 } 698 699 // DecodeMsg implements msgp.Decodable 700 func (z *StringProposal) DecodeMsg(dc *msgp.Reader) (err error) { 701 var zb0001 uint32 702 zb0001, err = dc.ReadArrayHeader() 703 if err != nil { 704 err = msgp.WrapError(err) 705 return 706 } 707 if zb0001 != 1 { 708 err = msgp.ArrayError{Wanted: 1, Got: zb0001} 709 return 710 } 711 z.Content, err = dc.ReadString() 712 if err != nil { 713 err = msgp.WrapError(err, "Content") 714 return 715 } 716 return 717 } 718 719 // EncodeMsg implements msgp.Encodable 720 func (z StringProposal) EncodeMsg(en *msgp.Writer) (err error) { 721 // array header, size 1 722 err = en.Append(0x91) 723 if err != nil { 724 return 725 } 726 err = en.WriteString(z.Content) 727 if err != nil { 728 err = msgp.WrapError(err, "Content") 729 return 730 } 731 return 732 } 733 734 // MarshalMsg implements msgp.Marshaler 735 func (z StringProposal) MarshalMsg(b []byte) (o []byte, err error) { 736 o = msgp.Require(b, z.Msgsize()) 737 // array header, size 1 738 o = append(o, 0x91) 739 o = msgp.AppendString(o, z.Content) 740 return 741 } 742 743 // UnmarshalMsg implements msgp.Unmarshaler 744 func (z *StringProposal) UnmarshalMsg(bts []byte) (o []byte, err error) { 745 var zb0001 uint32 746 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 747 if err != nil { 748 err = msgp.WrapError(err) 749 return 750 } 751 if zb0001 != 1 { 752 err = msgp.ArrayError{Wanted: 1, Got: zb0001} 753 return 754 } 755 z.Content, bts, err = msgp.ReadStringBytes(bts) 756 if err != nil { 757 err = msgp.WrapError(err, "Content") 758 return 759 } 760 o = bts 761 return 762 } 763 764 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 765 func (z StringProposal) Msgsize() (s int) { 766 s = 1 + msgp.StringPrefixSize + len(z.Content) 767 return 768 }