From d0f8c98b94639de808c570f2f9d58bf97c7df385 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Sat, 21 Jan 2023 11:48:26 +0100 Subject: [PATCH] Store contract code ledger entries --- .../internal/ledgerentry_storage/ledgerentry_storage.go | 4 ++++ go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/soroban-rpc/internal/ledgerentry_storage/ledgerentry_storage.go b/cmd/soroban-rpc/internal/ledgerentry_storage/ledgerentry_storage.go index f06e045d5c..d99b035cfd 100644 --- a/cmd/soroban-rpc/internal/ledgerentry_storage/ledgerentry_storage.go +++ b/cmd/soroban-rpc/internal/ledgerentry_storage/ledgerentry_storage.go @@ -219,6 +219,10 @@ func getRelevantLedgerKeyFromData(data xdr.LedgerEntryData) (xdr.LedgerKey, bool if err := key.SetContractData(data.ContractData.ContractId, data.ContractData.Val); err != nil { panic(err) } + case xdr.LedgerEntryTypeContractCode: + if err := key.SetContractCode(data.ContractCode.Hash); err != nil { + panic(err) + } default: // we don't care about any other entry types for now return xdr.LedgerKey{}, false diff --git a/go.mod b/go.mod index 44f7658cb9..e271892558 100644 --- a/go.mod +++ b/go.mod @@ -64,7 +64,7 @@ require ( github.com/spf13/cast v0.0.0-20150508191742-4d07383ffe94 // indirect github.com/spf13/jwalterweatherman v0.0.0-20141219030609-3d60171a6431 // indirect github.com/spf13/pflag v0.0.0-20161005214240-4bd69631f475 // indirect - github.com/stellar/go v0.0.0-20230119185507-a054386500f2 + github.com/stellar/go v0.0.0-20230120150719-164910adff87 github.com/stellar/go-xdr v0.0.0-20211103144802-8017fc4bdfee // indirect github.com/stretchr/objx v0.4.0 // indirect github.com/xanzy/ssh-agent v0.3.0 // indirect diff --git a/go.sum b/go.sum index f8c2f98338..bc8fde0c77 100644 --- a/go.sum +++ b/go.sum @@ -168,8 +168,8 @@ github.com/spf13/pflag v0.0.0-20161005214240-4bd69631f475 h1:RtZIgreTwcayPTOw7G5 github.com/spf13/pflag v0.0.0-20161005214240-4bd69631f475/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/viper v0.0.0-20150621231900-db7ff930a189 h1:fvB1AFbBd6SfI9Rd0ooAJp8uLkZDbZaLFHi7ZnNP6uI= github.com/spf13/viper v0.0.0-20150621231900-db7ff930a189/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= -github.com/stellar/go v0.0.0-20230119185507-a054386500f2 h1:BQ/FHVfSMyw593Q/2UQdeMZy1wbN4qG2HZRPvq+za4A= -github.com/stellar/go v0.0.0-20230119185507-a054386500f2/go.mod h1:QXwuKmYVvqQZlByv0EeNb0Rgog9AP+eMmARcdt3h2rI= +github.com/stellar/go v0.0.0-20230120150719-164910adff87 h1:G9TC6GyEn+sISTg5hxrcw/CD2NOKyWslvdBfnZMH1Z4= +github.com/stellar/go v0.0.0-20230120150719-164910adff87/go.mod h1:QXwuKmYVvqQZlByv0EeNb0Rgog9AP+eMmARcdt3h2rI= github.com/stellar/go-xdr v0.0.0-20211103144802-8017fc4bdfee h1:fbVs0xmXpBvVS4GBeiRmAE3Le70ofAqFMch1GTiq/e8= github.com/stellar/go-xdr v0.0.0-20211103144802-8017fc4bdfee/go.mod h1:yoxyU/M8nl9LKeWIoBrbDPQ7Cy+4jxRcWcOayZ4BMps= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=