github.com/annchain/OG@v0.0.9/og/message_archive/message_test.go (about) 1 package message_archive 2 3 import ( 4 "fmt" 5 types2 "github.com/annchain/OG/arefactor/og/types" 6 "github.com/annchain/OG/common/hexutil" 7 "github.com/annchain/OG/consensus/bft" 8 "github.com/annchain/OG/og/types" 9 10 "testing" 11 ) 12 13 func TestMarshal(t *testing.T) { 14 sp := SequencerProposal{ 15 types.Sequencer{ 16 TxBase: types.TxBase{ 17 Type: 0, 18 Hash: types2.Hash{}, 19 ParentsHash: nil, 20 AccountNonce: 0, 21 Height: 0, 22 PublicKey: nil, 23 Signature: nil, 24 MineNonce: 0, 25 Weight: 0, 26 Version: 0, 27 }, 28 Issuer: nil, 29 BlsJointSig: nil, 30 BlsJointPubKey: nil, 31 StateRoot: types2.Hash{}, 32 Proposing: false, 33 }, 34 } 35 36 mp := bft.BftMessageProposal{ 37 BftBasicInfo: bft.BftBasicInfo{ 38 SourceId: 777, 39 HeightRound: bft.HeightRound{ 40 Height: 22, 41 Round: 33, 42 }, 43 }, 44 Value: &sp, 45 ValidRound: 0, 46 } 47 var buffer []byte 48 buffer, err := mp.MarshalMsg(buffer) 49 if err != nil{ 50 panic(err) 51 } 52 fmt.Println(hexutil.Encode(buffer)) 53 54 }