Skip to content

Commit 1452457

Browse files
authored
Merge pull request #257 from xssnick/dev-v19
v1.10.1
2 parents d4afeb1 + 3d2d643 commit 1452457

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[![Based on TON][ton-svg]][ton]
66
[![Telegram Channel][tgc-svg]][tg-channel]
7-
![Coverage](https://img.shields.io/badge/Coverage-73.5%25-brightgreen)
7+
![Coverage](https://img.shields.io/badge/Coverage-73.6%25-brightgreen)
88

99
Golang library for interacting with TON blockchain.
1010

ton/getstate.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package ton
33
import (
44
"bytes"
55
"context"
6+
"errors"
67
"fmt"
78
"github.com/xssnick/tonutils-go/address"
89
"github.com/xssnick/tonutils-go/tl"
@@ -58,12 +59,6 @@ func (c *APIClient) GetAccount(ctx context.Context, block *BlockIDExt, addr *add
5859
return nil, fmt.Errorf("response with incorrect master block")
5960
}
6061

61-
if t.State == nil {
62-
return &tlb.Account{
63-
IsActive: false,
64-
}, nil
65-
}
66-
6762
if t.Proof == nil {
6863
return nil, fmt.Errorf("no proof")
6964
}
@@ -87,9 +82,17 @@ func (c *APIClient) GetAccount(ctx context.Context, block *BlockIDExt, addr *add
8782
}
8883

8984
shardAcc, balanceInfo, err := CheckAccountStateProof(addr, block, t.Proof, t.ShardProof, shardHash, c.proofCheckPolicy == ProofCheckPolicyUnsafe)
85+
if errors.Is(err, ErrNoAddrInProof) && t.State == nil {
86+
return &tlb.Account{
87+
IsActive: false,
88+
}, nil
89+
}
9090
if err != nil {
9191
return nil, fmt.Errorf("failed to check acc state proof: %w", err)
9292
}
93+
if t.State == nil {
94+
return nil, fmt.Errorf("state must be presented")
95+
}
9396

9497
if !bytes.Equal(shardAcc.Account.Hash(0), t.State.Hash()) {
9598
return nil, fmt.Errorf("proof hash not match state account hash")

0 commit comments

Comments
 (0)