File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ func (c *Client) RPCGetMultipleAccounts(ctx context.Context, accounts solana.Pub
176176}
177177
178178func (c * Client ) RPCGetTransaction (ctx context.Context , signature string ) (* rpc.GetTransactionResult , error ) {
179+ retry := 5
179180 for {
180181 r , err := c .rpcClient .GetTransaction (ctx ,
181182 solana .MustSignatureFromBase58 (signature ),
@@ -189,10 +190,15 @@ func (c *Client) RPCGetTransaction(ctx context.Context, signature string) (*rpc.
189190 time .Sleep (1 * time .Second )
190191 continue
191192 }
192- if err != nil || r . Meta == nil {
193- if strings . Contains ( err . Error (), "not found" ) {
193+ if err != nil && strings . Contains ( err . Error (), "not found" ) {
194+ if retry == 0 {
194195 return nil , nil
195196 }
197+ retry -= 1
198+ time .Sleep (1 * time .Second )
199+ continue
200+ }
201+ if err != nil || r .Meta == nil {
196202 return nil , fmt .Errorf ("solana.GetTransaction(%s) => %v" , signature , err )
197203 }
198204
You can’t perform that action at this time.
0 commit comments