@@ -16,7 +16,6 @@ import (
1616 "net/http"
1717 "strconv"
1818 "strings"
19- "sync/atomic"
2019
2120 "github.com/vechain/thor/v2/api"
2221 "github.com/vechain/thor/v2/api/transactions"
@@ -36,9 +35,8 @@ const (
3635// Client represents the HTTP client for interacting with the VeChainThor blockchain.
3736// It manages communication via HTTP requests.
3837type Client struct {
39- url string
40- c * http.Client
41- genesis atomic.Pointer [api.JSONCollapsedBlock ]
38+ url string
39+ c * http.Client
4240}
4341
4442// New creates a new Client with the provided URL.
@@ -48,9 +46,8 @@ func New(url string) *Client {
4846
4947func NewWithHTTP (url string , c * http.Client ) * Client {
5048 return & Client {
51- url : url ,
52- c : c ,
53- genesis : atomic.Pointer [api.JSONCollapsedBlock ]{},
49+ url : url ,
50+ c : c ,
5451 }
5552}
5653
@@ -220,9 +217,6 @@ func (c *Client) SendTransaction(obj *api.RawTx) (*api.SendTxResult, error) {
220217
221218// GetBlock retrieves a block by its block ID.
222219func (c * Client ) GetBlock (blockID string ) (* api.JSONCollapsedBlock , error ) {
223- if blockID == "0" && c .genesis .Load () != nil {
224- return c .genesis .Load (), nil
225- }
226220 body , err := c .httpGET (c .url + "/blocks/" + blockID )
227221 if err != nil {
228222 return nil , fmt .Errorf ("unable to retrieve block - %w" , err )
@@ -237,11 +231,6 @@ func (c *Client) GetBlock(blockID string) (*api.JSONCollapsedBlock, error) {
237231 return nil , fmt .Errorf ("unable to unmarshal block - %w" , err )
238232 }
239233
240- if block .Number == 0 {
241- // Cache the genesis block for future requests
242- c .genesis .Store (& block )
243- }
244-
245234 return & block , nil
246235}
247236
0 commit comments