diff --git a/go.mod b/go.mod index 983eb75..10a4f4c 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( github.com/btcsuite/btcd v0.21.0-beta github.com/btcsuite/btcutil v1.0.2 - github.com/coinbase/rosetta-sdk-go v0.5.7 + github.com/coinbase/rosetta-sdk-go v0.5.8-0.20201027202152-ec894b6612f8 github.com/dgraph-io/badger/v2 v2.2007.2 github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 github.com/stretchr/testify v1.6.1 diff --git a/go.sum b/go.sum index e461970..905b38a 100644 --- a/go.sum +++ b/go.sum @@ -61,8 +61,8 @@ github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/coinbase/rosetta-sdk-go v0.5.7 h1:BaR/+O3GzrsyunVNkVQHtjDCcId8G1Fh/RqEbeyExnk= -github.com/coinbase/rosetta-sdk-go v0.5.7/go.mod h1:l5aNeyeZKBkmWbVdkdLpWdToQ6hTwI7cZ1OU9cMbljY= +github.com/coinbase/rosetta-sdk-go v0.5.8-0.20201027202152-ec894b6612f8 h1:oOe+VuEj7mZdiAAr/r2Lmbdkl2mQoUhce74y0jReFtI= +github.com/coinbase/rosetta-sdk-go v0.5.8-0.20201027202152-ec894b6612f8/go.mod h1:l5aNeyeZKBkmWbVdkdLpWdToQ6hTwI7cZ1OU9cMbljY= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= diff --git a/indexer/indexer.go b/indexer/indexer.go index 15bdc02..1d1de87 100644 --- a/indexer/indexer.go +++ b/indexer/indexer.go @@ -783,23 +783,25 @@ func (i *Indexer) GetBalance( currency *types.Currency, blockIdentifier *types.PartialBlockIdentifier, ) (*types.Amount, *types.BlockIdentifier, error) { - // TODO: add block lazy transactional - blockResponse, err := i.GetBlockLazy(ctx, blockIdentifier) + dbTx := i.database.NewDatabaseTransaction(ctx, false) + defer dbTx.Discard(ctx) + + blockResponse, err := i.blockStorage.GetBlockLazyTransactional( + ctx, + blockIdentifier, + dbTx, + ) if err != nil { return nil, nil, err } - // TODO: when false if we query unknown, this could cause issue - // TODO: add switch to not create unknown - dbTx := i.database.NewDatabaseTransaction(ctx, false) - defer dbTx.Discard(ctx) - amount, err := i.balanceStorage.GetBalanceTransactional( ctx, dbTx, accountIdentifier, currency, blockResponse.Block.BlockIdentifier, + false, ) if err != nil { return nil, nil, err