OSDN Git Service

Remove reference data in TxInput & TxOutput (#420)
[bytom/bytom.git] / protocol / bc / legacy / fuzz_test.go
1 package legacy
2
3 import "testing"
4
5 func TestFuzzUnknownAssetVersion(t *testing.T) {
6         const rawTx = `0701000001012b00030a0908fa48ca4e0150f83fbf26cf83211d136313cde98601a667d999ab9cc27b723d4680a094a58d1d2903deff1d4319d67baa10a6d26c1fea9c3e8d30e33474efee1a610a9bb49d758d000101010103010203010129000000000000000000000000000000000000000000000000000000000000000080a094a58d1d01010100`
7
8         var want Tx
9         err := want.UnmarshalText([]byte(rawTx))
10         if err != nil {
11                 t.Fatal(err)
12         }
13
14         b, err := want.MarshalText()
15         if err != nil {
16                 t.Fatal(err)
17         }
18
19         // Make sure serialzing and deserializing gives the same tx
20         var got Tx
21         err = got.UnmarshalText(b)
22         if err != nil {
23                 t.Fatal(err)
24         }
25         if got.ID.String() != want.ID.String() {
26                 t.Errorf("tx id changed to %s", got.ID.String())
27         }
28 }