Skip to content

Commit 49fc84d

Browse files
authored
Merge pull request #373 from scrtlabs/make-rosetta-work
Hardcode genesis block to make Rosetta shut up
2 parents ea64f27 + fa873fa commit 49fc84d

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

server/rosetta/lib/internal/service/online.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,26 @@ package service
22

33
import (
44
"context"
5-
"time"
65

76
"github.com/coinbase/rosetta-sdk-go/types"
87

98
crgerrs "github.com/cosmos/cosmos-sdk/server/rosetta/lib/errors"
109
crgtypes "github.com/cosmos/cosmos-sdk/server/rosetta/lib/types"
1110
)
1211

13-
// genesisBlockFetchTimeout defines a timeout to fetch the genesis block
14-
const genesisBlockFetchTimeout = 15 * time.Second
15-
1612
// NewOnlineNetwork builds a single network adapter.
1713
// It will get the Genesis block on the beginning to avoid calling it everytime.
1814
func NewOnlineNetwork(network *types.NetworkIdentifier, client crgtypes.Client) (crgtypes.API, error) {
19-
ctx, cancel := context.WithTimeout(context.Background(), genesisBlockFetchTimeout)
20-
defer cancel()
21-
22-
var genesisHeight int64 = -1 // to use initial_height in genesis.json
23-
block, err := client.BlockByHeight(ctx, &genesisHeight)
24-
if err != nil {
25-
return OnlineNetwork{}, err
15+
blockId := &types.BlockIdentifier{
16+
Index: 813800,
17+
Hash: "C168FE742EC3DCD6911B31CEE7F0C58EF7621EB85E87193875CD9C2C7E74473C",
2618
}
2719

2820
return OnlineNetwork{
2921
client: client,
3022
network: network,
31-
networkOptions: networkOptionsFromClient(client, block.Block),
32-
genesisBlockIdentifier: block.Block,
23+
networkOptions: networkOptionsFromClient(client, blockId),
24+
genesisBlockIdentifier: blockId,
3325
}, nil
3426
}
3527

0 commit comments

Comments
 (0)