Skip to content

Commit

Permalink
Node: Fix repair_solana tool
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley committed Aug 27, 2024
1 parent 9547238 commit 6ea6c1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
18 changes: 12 additions & 6 deletions node/hack/repair_solana/repair.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func main() {
offset := firstSeq - p.Sequence - 10
log.Printf("repairing: %d (offset %d)", p.Sequence, offset)

var tx *rpc.TransactionWithMeta
var tx *rpc.GetTransactionResult
var nseq uint64
var err error

Expand Down Expand Up @@ -243,8 +243,14 @@ func main() {
}
}

func fetchTxSeq(ctx context.Context, c *rpc.Client, sig solana.Signature) (*rpc.TransactionWithMeta, uint64, error) {
out, err := c.GetConfirmedTransaction(ctx, sig)
func fetchTxSeq(ctx context.Context, c *rpc.Client, sig solana.Signature) (*rpc.GetTransactionResult, uint64, error) {
maxSupportedTransactionVersion := uint64(0)
params := rpc.GetTransactionOpts{
Encoding: solana.EncodingBase64,
Commitment: rpc.CommitmentConfirmed,
MaxSupportedTransactionVersion: &maxSupportedTransactionVersion,
}
out, err := c.GetTransaction(ctx, sig, &params)
if err != nil {
return nil, 0, fmt.Errorf("GetConfirmedTransaction: %v", err)
}
Expand All @@ -262,14 +268,14 @@ func fetchTxSeq(ctx context.Context, c *rpc.Client, sig solana.Signature) (*rpc.
return nil, 0, nil
}

func process(txRpc *rpc.TransactionWithMeta) (*solana.PublicKey, error) {
func process(out *rpc.GetTransactionResult) (*solana.PublicKey, error) {
program, err := solana.PublicKeyFromBase58(*solanaAddr)
if err != nil {
log.Fatalf("Invalid program address: %v", err)
return nil, err
}

tx, err := txRpc.GetTransaction()
tx, err := out.Transaction.GetTransaction()
if err != nil {
log.Fatalf("Failed to unmarshal transaction: %v", err)
return nil, err
Expand All @@ -290,7 +296,7 @@ func process(txRpc *rpc.TransactionWithMeta) (*solana.PublicKey, error) {

txs := make([]solana.CompiledInstruction, 0, len(tx.Message.Instructions))
txs = append(txs, tx.Message.Instructions...)
for _, inner := range txRpc.Meta.InnerInstructions {
for _, inner := range out.Meta.InnerInstructions {
txs = append(txs, inner.Instructions...)
}

Expand Down
3 changes: 0 additions & 3 deletions sdk/mainnet_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ import (
//
// This list is duplicated a couple times across the codebase - make to to update all copies!
var PublicRPCEndpoints = []string{
"https://wormhole-v2-mainnet-api.certus.one",
"https://wormhole.inotel.ro",
"https://wormhole-v2-mainnet-api.mcf.rocks",
"https://wormhole-v2-mainnet-api.chainlayer.network",
"https://wormhole-v2-mainnet-api.staking.fund",
"https://wormhole-v2-mainnet.01node.com",
}

type (
Expand Down

0 comments on commit 6ea6c1a

Please sign in to comment.