diff --git a/tlb/block_test.go b/tlb/block_test.go index 839e1f41..bd6b562d 100644 --- a/tlb/block_test.go +++ b/tlb/block_test.go @@ -49,6 +49,10 @@ func Test_tlb_Unmarshal(t *testing.T) { name: "block (0,8000000000000000,40484438)", folder: "testdata/block-3", }, + { + name: "block (0,D83800000000000,4168601)", + folder: "testdata/block-4", + }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { @@ -56,16 +60,16 @@ func Test_tlb_Unmarshal(t *testing.T) { inputFilename := path.Join(tc.folder, "block.bin") data, err := os.ReadFile(inputFilename) if err != nil { - t.Errorf("ReadFile() failed: %v", err) + t.Fatalf("ReadFile() failed: %v", err) } cell, err := boc.DeserializeBoc(data) if err != nil { - t.Errorf("boc.DeserializeBoc() failed: %v", err) + t.Fatalf("boc.DeserializeBoc() failed: %v", err) } var block Block err = Unmarshal(cell[0], &block) if err != nil { - t.Errorf("Unmarshal() failed: %v", err) + t.Fatalf("Unmarshal() failed: %v", err) } accounts := map[string]*AccountBlock{} var txHashes []string diff --git a/tlb/proof.go b/tlb/proof.go index 8667a2db..bfdda06e 100644 --- a/tlb/proof.go +++ b/tlb/proof.go @@ -86,17 +86,24 @@ func (s *ShardState) UnmarshalTLB(c *boc.Cell, decoder *Decoder) error { if err != nil { return err } - err = decoder.Unmarshal(c1, &s.SplitState.Left) - if err != nil { - return err + if c1.CellType() != boc.PrunedBranchCell { + err = decoder.Unmarshal(c1, &s.SplitState.Left) + if err != nil { + return err + } + } else { + s.SplitState.Left = ShardStateUnsplit{} } c1, err = c.NextRef() if err != nil { return err } - err = decoder.Unmarshal(c1, &s.SplitState.Right) - if err != nil { - return err + if c1.CellType() != boc.PrunedBranchCell { + if err := decoder.Unmarshal(c1, &s.SplitState.Right); err != nil { + return err + } + } else { + s.SplitState.Right = ShardStateUnsplit{} } s.SumType = "SplitState" break diff --git a/tlb/testdata/block-4/block.bin b/tlb/testdata/block-4/block.bin new file mode 100644 index 00000000..7e322151 Binary files /dev/null and b/tlb/testdata/block-4/block.bin differ diff --git a/tlb/testdata/block-4/block.expected.json b/tlb/testdata/block-4/block.expected.json new file mode 100644 index 00000000..dc468df3 --- /dev/null +++ b/tlb/testdata/block-4/block.expected.json @@ -0,0 +1,45 @@ +{ + "Accounts": {}, + "TxHashes": null, + "ValueFlow": { + "FromPrevBlk": { + "Grams": "115778059391", + "Other": {} + }, + "ToNextBlk": { + "Grams": "115778059391", + "Other": {} + }, + "Imported": { + "Grams": "0", + "Other": {} + }, + "Exported": { + "Grams": "0", + "Other": {} + }, + "FeesCollected": { + "Grams": "15258", + "Other": {} + }, + "Burned": null, + "FeesImported": { + "Grams": "0", + "Other": {} + }, + "Recovered": { + "Grams": "0", + "Other": {} + }, + "Created": { + "Grams": "15258", + "Other": {} + }, + "Minted": { + "Grams": "0", + "Other": {} + } + }, + "InMsgDescrLength": 0, + "OutMsgDescrLength": 0 + } \ No newline at end of file