Compare commits

..

5 commits

Author SHA1 Message Date
Thomas Zarebczan
3ba4c37047
LBRY
LBRY Updates
2020-12-08 00:08:02 -05:00
Thomas Zarebczan
0b1ea81c0f
Upstream merge 2020-11-17 03:36:34 -05:00
Thomas Zarebczan
2b2364e69c
Fix coinbase 2020-11-17 03:27:17 -05:00
Thomas Zarebczan
f9a35c2474
Merge pull request #2 from lbryio/lbry
LBRY changes
2020-11-17 03:20:55 -05:00
Thomas Zarebczan
f92c407370
LBRY changes
more


more
2020-11-17 03:20:36 -05:00
16 changed files with 83 additions and 139 deletions

View file

@ -77,12 +77,6 @@ RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
# Use native remote build context to build in any directory
COPY . src
## Cleanup
RUN cd src \
&& rm go.sum \
&& go mod edit -replace github.com/golang/lint=golang.org/x/lint@latest \
&& go clean -modcache
RUN cd src \
&& go build \
&& cd .. \

View file

@ -25,7 +25,7 @@ import (
"github.com/lbryio/rosetta-lbry/lbry"
"github.com/btcsuite/btcd/chaincfg"
"github.com/coinbase/rosetta-sdk-go/storage/encoder"
"github.com/coinbase/rosetta-sdk-go/storage"
"github.com/coinbase/rosetta-sdk-go/types"
)
@ -121,7 +121,7 @@ type Configuration struct {
Pruning *PruningConfiguration
IndexerPath string
LBRYcrdPath string
Compressors []*encoder.CompressorEntry
Compressors []*storage.CompressorEntry
}
// LoadConfiguration attempts to create a new Configuration
@ -167,7 +167,7 @@ func LoadConfiguration(baseDirectory string) (*Configuration, error) {
config.Currency = lbry.MainnetCurrency
config.ConfigPath = mainnetConfigPath
config.RPCPort = mainnetRPCPort
config.Compressors = []*encoder.CompressorEntry{
config.Compressors = []*storage.CompressorEntry{
{
Namespace: transactionNamespace,
DictionaryPath: mainnetTransactionDictionary,
@ -183,7 +183,7 @@ func LoadConfiguration(baseDirectory string) (*Configuration, error) {
config.Currency = lbry.TestnetCurrency
config.ConfigPath = testnetConfigPath
config.RPCPort = testnetRPCPort
config.Compressors = []*encoder.CompressorEntry{
config.Compressors = []*storage.CompressorEntry{
{
Namespace: transactionNamespace,
DictionaryPath: testnetTransactionDictionary,

View file

@ -22,7 +22,7 @@ import (
"github.com/lbryio/rosetta-lbry/lbry"
"github.com/coinbase/rosetta-sdk-go/storage/encoder"
"github.com/coinbase/rosetta-sdk-go/storage"
"github.com/coinbase/rosetta-sdk-go/types"
"github.com/coinbase/rosetta-sdk-go/utils"
"github.com/stretchr/testify/assert"
@ -70,7 +70,7 @@ func TestLoadConfiguration(t *testing.T) {
Depth: pruneDepth,
MinHeight: minPruneHeight,
},
Compressors: []*encoder.CompressorEntry{
Compressors: []*storage.CompressorEntry{
{
Namespace: transactionNamespace,
DictionaryPath: mainnetTransactionDictionary,
@ -99,7 +99,7 @@ func TestLoadConfiguration(t *testing.T) {
Depth: pruneDepth,
MinHeight: minPruneHeight,
},
Compressors: []*encoder.CompressorEntry{
Compressors: []*storage.CompressorEntry{
{
Namespace: transactionNamespace,
DictionaryPath: testnetTransactionDictionary,

3
go.mod
View file

@ -10,7 +10,8 @@ require (
github.com/alexkohler/nakedret v1.0.0 // indirect
github.com/btcsuite/btcd v0.21.0-beta
github.com/btcsuite/btcutil v1.0.2
github.com/coinbase/rosetta-sdk-go v0.6.3
github.com/client9/misspell v0.3.4 // indirect
github.com/coinbase/rosetta-sdk-go v0.6.1
github.com/dgraph-io/badger/v2 v2.2007.2
github.com/golang/lint v0.0.0-20200302205851-738671d3881b // indirect
github.com/gordonklaus/ineffassign v0.0.0-20201107091007-3b93a8888063 // indirect

25
go.sum
View file

@ -30,8 +30,6 @@ github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8=
github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6 h1:1d9pzdbkth4D9AX6ndKSl7of3UTV0RYl3z64U2dXMGo=
github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/alecthomas/gocyclo v0.0.0-20150208221726-aa8f8b160214 h1:YI/8G3uLbYyowJeOPVL6BMKe2wbL54h0FdEKmncU6lU=
github.com/alecthomas/gocyclo v0.0.0-20150208221726-aa8f8b160214/go.mod h1:Ef5UOtJdJ5rVFObdOVsrNgKV/Wf4I+daTCSk8GTrHIk=
@ -46,14 +44,12 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5
github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ=
github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8=
github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M=
github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2uts=
github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts=
@ -77,8 +73,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.6.3 h1:PPj14tPJ7SFc8sY/hlwK8zddT7PKwWU2wicxyerDxlg=
github.com/coinbase/rosetta-sdk-go v0.6.3/go.mod h1:MvQfsL2KlJ5786OdDviRIJE3agui2YcvS1CaQPDl1Yo=
github.com/coinbase/rosetta-sdk-go v0.6.1 h1:aOb5qstlX0uqP9HRC7wCY+YAZDzZbS2C/i3Qy/lR3xM=
github.com/coinbase/rosetta-sdk-go v0.6.1/go.mod h1:t36UuaD4p2DSXaSH9IwMasZDJ7UPxt9cQi6alS5OPTo=
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=
@ -162,11 +158,11 @@ github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gordonklaus/ineffassign v0.0.0-20201107091007-3b93a8888063 h1:dKprcOvlsvqfWn/iGvz+oYuC2axESeSMuF8dDrWMNsE=
github.com/gordonklaus/ineffassign v0.0.0-20201107091007-3b93a8888063/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc=
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 h1:FlFbCRLd5Jr4iYXZufAvgWN6Ao0JrI5chLINnUXDDr0=
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI=
@ -230,8 +226,6 @@ github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8
github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0=
github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
github.com/neilotoole/errgroup v0.1.5 h1:DxEGoIfFm5ooGicidR+okiHjoOaGRKFaSxDPVZuuu2I=
github.com/neilotoole/errgroup v0.1.5/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
@ -270,8 +264,6 @@ github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9Ac
github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/segmentio/fasthash v1.0.3 h1:EI9+KE1EwvMLBWwjpRDc+fEM+prwxDYbslddQGtrmhM=
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
@ -294,7 +286,6 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stripe/safesql v0.2.0 h1:xiefmCDd8c35PVSGrL2FhBiaKxviXnGziBDOpOejeBE=
@ -313,18 +304,17 @@ github.com/tidwall/sjson v1.1.2/go.mod h1:SEzaDwxiPzKzNfUEO4HbYF/m4UCSJDsGgNqsS1
github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9 h1:vY5WqiEon0ZSTGM3ayVVi+twaHKHDFUVloaQ/wug9/c=
github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9/go.mod h1:q+QjxYvZ+fpjMXqs+XEriussHjSYqeXVnAdSV1tkMYk=
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs=
github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/vmihailenco/msgpack/v5 v5.1.0 h1:+od5YbEXxW95SPlW6beocmt8nOtlh83zqat5Ip9Hwdc=
github.com/vmihailenco/msgpack/v5 v5.1.0/go.mod h1:C5gboKD0TJPqWDTVTtrQNfRbiBwHZGo8UTqP/9/XvLI=
github.com/vmihailenco/msgpack/v5 v5.0.0-beta.9 h1:iBRIniTnWOo0kqkg3k3XR8Vn6OCkVlIuZNo0UoBrKx4=
github.com/vmihailenco/msgpack/v5 v5.0.0-beta.9/go.mod h1:HVxBVPUK/+fZMonk4bi1islLa8V3cfnBug0+4dykPzo=
github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vbd1qPqc=
github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
github.com/walle/lll v1.0.1 h1:lbK8008fOXbQNYt8daBGUrjvElvlwlE7D7N/9dLP5IQ=
github.com/walle/lll v1.0.1/go.mod h1:lYxcXzoPhiAHR9eaq+Yv7RYg1nIipLloBCIfPUzfaWQ=
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
@ -340,7 +330,6 @@ go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=

View file

@ -18,12 +18,11 @@ import (
"context"
"github.com/coinbase/rosetta-sdk-go/parser"
"github.com/coinbase/rosetta-sdk-go/storage/database"
"github.com/coinbase/rosetta-sdk-go/storage/modules"
"github.com/coinbase/rosetta-sdk-go/storage"
"github.com/coinbase/rosetta-sdk-go/types"
)
var _ modules.BalanceStorageHandler = (*BalanceStorageHandler)(nil)
var _ storage.BalanceStorageHandler = (*BalanceStorageHandler)(nil)
// BalanceStorageHandler implements storage.BalanceStorageHandler.
type BalanceStorageHandler struct{}
@ -45,21 +44,3 @@ func (h *BalanceStorageHandler) BlockRemoved(
) error {
return nil
}
// AccountsReconciled updates the total accounts reconciled by count.
func (h *BalanceStorageHandler) AccountsReconciled(
ctx context.Context,
dbTx database.Transaction,
count int,
) error {
return nil
}
// AccountsSeen updates the total accounts seen by count.
func (h *BalanceStorageHandler) AccountsSeen(
ctx context.Context,
dbTx database.Transaction,
count int,
) error {
return nil
}

View file

@ -16,21 +16,14 @@ package indexer
import (
"context"
"errors"
"math/big"
"github.com/coinbase/rosetta-sdk-go/asserter"
"github.com/coinbase/rosetta-sdk-go/parser"
"github.com/coinbase/rosetta-sdk-go/storage/database"
"github.com/coinbase/rosetta-sdk-go/storage/modules"
"github.com/coinbase/rosetta-sdk-go/storage"
"github.com/coinbase/rosetta-sdk-go/types"
)
var _ modules.BalanceStorageHelper = (*BalanceStorageHelper)(nil)
var (
errNotImplemented = errors.New("not implemented")
)
var _ storage.BalanceStorageHelper = (*BalanceStorageHelper)(nil)
// BalanceStorageHelper implements storage.BalanceStorageHelper.
type BalanceStorageHelper struct {
@ -67,19 +60,3 @@ func (h *BalanceStorageHelper) ExemptFunc() parser.ExemptOperation {
return false
}
}
// AccountsReconciled returns the total accounts reconciled by count.
func (h *BalanceStorageHelper) AccountsReconciled(
ctx context.Context,
dbTx database.Transaction,
) (*big.Int, error) {
return nil, errNotImplemented
}
// AccountsSeen returns the total accounts seen by count.
func (h *BalanceStorageHelper) AccountsSeen(
ctx context.Context,
dbTx database.Transaction,
) (*big.Int, error) {
return nil, errNotImplemented
}

View file

@ -17,23 +17,22 @@ package indexer
import (
"context"
"github.com/coinbase/rosetta-sdk-go/storage/database"
"github.com/coinbase/rosetta-sdk-go/storage/modules"
"github.com/coinbase/rosetta-sdk-go/storage"
"github.com/coinbase/rosetta-sdk-go/types"
)
var _ modules.CoinStorageHelper = (*CoinStorageHelper)(nil)
var _ storage.CoinStorageHelper = (*CoinStorageHelper)(nil)
// CoinStorageHelper implements storage.CoinStorageHelper.
type CoinStorageHelper struct {
b *modules.BlockStorage
b *storage.BlockStorage
}
// CurrentBlockIdentifier returns the current head block identifier
// and is used to comply with the CoinStorageHelper interface.
func (h *CoinStorageHelper) CurrentBlockIdentifier(
ctx context.Context,
transaction database.Transaction,
transaction storage.DatabaseTransaction,
) (*types.BlockIdentifier, error) {
return h.b.GetHeadBlockIdentifierTransactional(ctx, transaction)
}

View file

@ -26,9 +26,7 @@ import (
"github.com/lbryio/rosetta-lbry/utils"
"github.com/coinbase/rosetta-sdk-go/asserter"
"github.com/coinbase/rosetta-sdk-go/storage/database"
storageErrs "github.com/coinbase/rosetta-sdk-go/storage/errors"
"github.com/coinbase/rosetta-sdk-go/storage/modules"
"github.com/coinbase/rosetta-sdk-go/storage"
"github.com/coinbase/rosetta-sdk-go/syncer"
"github.com/coinbase/rosetta-sdk-go/types"
sdkUtils "github.com/coinbase/rosetta-sdk-go/utils"
@ -72,7 +70,7 @@ type Client interface {
ParseBlock(
context.Context,
*lbry.Block,
map[string]*types.AccountCoin,
map[string]*storage.AccountCoin,
) (*types.Block, error)
}
@ -90,11 +88,11 @@ type Indexer struct {
client Client
asserter *asserter.Asserter
database database.Database
blockStorage *modules.BlockStorage
balanceStorage *modules.BalanceStorage
coinStorage *modules.CoinStorage
workers []modules.BlockWorker
database storage.Database
blockStorage *storage.BlockStorage
balanceStorage *storage.BalanceStorage
coinStorage *storage.CoinStorage
workers []storage.BlockWorker
waiter *waitTable
}
@ -127,11 +125,11 @@ func defaultBadgerOptions(
opts.ValueLogLoadingMode = options.MemoryMap
// Use an extended table size for larger commits.
opts.MaxTableSize = database.DefaultMaxTableSize
opts.MaxTableSize = storage.DefaultMaxTableSize
// Smaller value log sizes means smaller contiguous memory allocations
// and less RAM usage on cleanup.
opts.ValueLogFileSize = database.DefaultLogValueSize
opts.ValueLogFileSize = storage.DefaultLogValueSize
// To allow writes at a faster speed, we create a new memtable as soon as
// an existing memtable is filled up. This option determines how many
@ -166,11 +164,11 @@ func Initialize(
config *configuration.Configuration,
client Client,
) (*Indexer, error) {
localStore, err := database.NewBadgerDatabase(
localStore, err := storage.NewBadgerStorage(
ctx,
config.IndexerPath,
database.WithCompressorEntries(config.Compressors),
database.WithCustomSettings(defaultBadgerOptions(
storage.WithCompressorEntries(config.Compressors),
storage.WithCustomSettings(defaultBadgerOptions(
config.IndexerPath,
)),
)
@ -178,7 +176,7 @@ func Initialize(
return nil, fmt.Errorf("%w: unable to initialize storage", err)
}
blockStorage := modules.NewBlockStorage(localStore)
blockStorage := storage.NewBlockStorage(localStore)
asserter, err := asserter.NewClientWithOptions(
config.Network,
config.GenesisBlockIdentifier,
@ -202,21 +200,21 @@ func Initialize(
asserter: asserter,
}
coinStorage := modules.NewCoinStorage(
coinStorage := storage.NewCoinStorage(
localStore,
&CoinStorageHelper{blockStorage},
asserter,
)
i.coinStorage = coinStorage
balanceStorage := modules.NewBalanceStorage(localStore)
balanceStorage := storage.NewBalanceStorage(localStore)
balanceStorage.Initialize(
&BalanceStorageHelper{asserter},
&BalanceStorageHandler{},
)
i.balanceStorage = balanceStorage
i.workers = []modules.BlockWorker{coinStorage, balanceStorage}
i.workers = []storage.BlockWorker{coinStorage, balanceStorage}
return i, nil
}
@ -424,14 +422,14 @@ func (i *Indexer) findCoin(
coinIdentifier string,
) (*types.Coin, *types.AccountIdentifier, error) {
for ctx.Err() == nil {
databaseTransaction := i.database.ReadTransaction(ctx)
databaseTransaction := i.database.NewDatabaseTransaction(ctx, false)
defer databaseTransaction.Discard(ctx)
coinHeadBlock, err := i.blockStorage.GetHeadBlockIdentifierTransactional(
ctx,
databaseTransaction,
)
if errors.Is(err, storageErrs.ErrHeadBlockNotFound) {
if errors.Is(err, storage.ErrHeadBlockNotFound) {
if err := sdkUtils.ContextSleep(ctx, missingTransactionDelay); err != nil {
return nil, nil, err
}
@ -457,7 +455,7 @@ func (i *Indexer) findCoin(
return coin, owner, nil
}
if !errors.Is(err, storageErrs.ErrCoinNotFound) {
if !errors.Is(err, storage.ErrCoinNotFound) {
return nil, nil, fmt.Errorf("%w: unable to lookup coin %s", err, coinIdentifier)
}
@ -508,7 +506,7 @@ func (i *Indexer) checkHeaderMatch(
btcBlock *lbry.Block,
) error {
headBlock, err := i.blockStorage.GetHeadBlockIdentifier(ctx)
if err != nil && !errors.Is(err, storageErrs.ErrHeadBlockNotFound) {
if err != nil && !errors.Is(err, storage.ErrHeadBlockNotFound) {
return fmt.Errorf("%w: unable to lookup head block", err)
}
@ -527,12 +525,12 @@ func (i *Indexer) findCoins(
ctx context.Context,
btcBlock *lbry.Block,
coins []string,
) (map[string]*types.AccountCoin, error) {
) (map[string]*storage.AccountCoin, error) {
if err := i.checkHeaderMatch(ctx, btcBlock); err != nil {
return nil, fmt.Errorf("%w: check header match failed", err)
}
coinMap := map[string]*types.AccountCoin{}
coinMap := map[string]*storage.AccountCoin{}
remainingCoins := []string{}
for _, coinIdentifier := range coins {
coin, owner, err := i.findCoin(
@ -541,7 +539,7 @@ func (i *Indexer) findCoins(
coinIdentifier,
)
if err == nil {
coinMap[coinIdentifier] = &types.AccountCoin{
coinMap[coinIdentifier] = &storage.AccountCoin{
Account: owner,
Coin: coin,
}
@ -675,7 +673,7 @@ func (i *Indexer) GetScriptPubKeys(
ctx context.Context,
coins []*types.Coin,
) ([]*lbry.ScriptPubKey, error) {
databaseTransaction := i.database.ReadTransaction(ctx)
databaseTransaction := i.database.NewDatabaseTransaction(ctx, false)
defer databaseTransaction.Discard(ctx)
scripts := make([]*lbry.ScriptPubKey, len(coins))
@ -788,7 +786,7 @@ func (i *Indexer) GetBalance(
currency *types.Currency,
blockIdentifier *types.PartialBlockIdentifier,
) (*types.Amount, *types.BlockIdentifier, error) {
dbTx := i.database.ReadTransaction(ctx)
dbTx := i.database.NewDatabaseTransaction(ctx, false)
defer dbTx.Discard(ctx)
blockResponse, err := i.blockStorage.GetBlockLazyTransactional(
@ -807,7 +805,7 @@ func (i *Indexer) GetBalance(
currency,
blockResponse.Block.BlockIdentifier.Index,
)
if errors.Is(err, storageErrs.ErrAccountMissing) {
if errors.Is(err, storage.ErrAccountMissing) {
return &types.Amount{
Value: zeroValue,
Currency: currency,

View file

@ -27,6 +27,7 @@ import (
"github.com/lbryio/rosetta-lbry/lbry"
mocks "github.com/lbryio/rosetta-lbry/mocks/indexer"
"github.com/coinbase/rosetta-sdk-go/storage"
"github.com/coinbase/rosetta-sdk-go/types"
"github.com/coinbase/rosetta-sdk-go/utils"
"github.com/stretchr/testify/assert"
@ -156,7 +157,7 @@ func TestIndexer_Pruning(t *testing.T) {
"ParseBlock",
mock.Anything,
block,
map[string]*types.AccountCoin{},
map[string]*storage.AccountCoin{},
).Return(
blockReturn,
nil,
@ -166,7 +167,7 @@ func TestIndexer_Pruning(t *testing.T) {
"ParseBlock",
mock.Anything,
block,
map[string]*types.AccountCoin{},
map[string]*storage.AccountCoin{},
).Return(
blockReturn,
nil,
@ -285,8 +286,8 @@ func TestIndexer_Transactions(t *testing.T) {
Index: 0,
NetworkIndex: &index0,
},
Status: types.String(bitcoin.SuccessStatus),
Type: bitcoin.OutputOpType,
Status: types.String(lbry.SuccessStatus),
Type: lbry.OutputOpType,
Account: &types.AccountIdentifier{
Address: rawHash,
},
@ -355,9 +356,9 @@ func TestIndexer_Transactions(t *testing.T) {
Transactions: transactions,
}
coinMap := map[string]*types.AccountCoin{}
coinMap := map[string]*storage.AccountCoin{}
for _, coinIdentifier := range requiredCoins {
coinMap[coinIdentifier] = &types.AccountCoin{
coinMap[coinIdentifier] = &storage.AccountCoin{
Account: coinBank[coinIdentifier].Account,
Coin: coinBank[coinIdentifier].Coin,
}
@ -504,8 +505,8 @@ func TestIndexer_Reorg(t *testing.T) {
Index: 0,
NetworkIndex: &index0,
},
Status: types.String(bitcoin.SuccessStatus),
Type: bitcoin.OutputOpType,
Status: types.String(lbry.SuccessStatus),
Type: lbry.OutputOpType,
Account: &types.AccountIdentifier{
Address: rawHash,
},
@ -601,9 +602,9 @@ func TestIndexer_Reorg(t *testing.T) {
Transactions: transactions,
}
coinMap := map[string]*types.AccountCoin{}
coinMap := map[string]*storage.AccountCoin{}
for _, coinIdentifier := range requiredCoins {
coinMap[coinIdentifier] = &types.AccountCoin{
coinMap[coinIdentifier] = &storage.AccountCoin{
Account: coinBank[coinIdentifier].Account,
Coin: coinBank[coinIdentifier].Coin,
}
@ -773,7 +774,7 @@ func TestIndexer_HeaderReorg(t *testing.T) {
Transactions: transactions,
}
coinMap := map[string]*types.AccountCoin{}
coinMap := map[string]*storage.AccountCoin{}
if i == 400 {
mockClient.On(
"ParseBlock",

View file

@ -29,6 +29,7 @@ import (
lbryUtils "github.com/lbryio/rosetta-lbry/utils"
"github.com/btcsuite/btcutil"
"github.com/coinbase/rosetta-sdk-go/storage"
"github.com/coinbase/rosetta-sdk-go/types"
"github.com/coinbase/rosetta-sdk-go/utils"
)
@ -245,7 +246,7 @@ func (b *Client) GetRawBlock(
func (b *Client) ParseBlock(
ctx context.Context,
block *Block,
coins map[string]*types.AccountCoin,
coins map[string]*storage.AccountCoin,
) (*types.Block, error) {
rblock, err := b.parseBlockData(block)
if err != nil {
@ -492,7 +493,7 @@ func skipTransactionOperations(blockNumber int64, blockHash string, transactionH
func (b *Client) parseTransactions(
ctx context.Context,
block *Block,
coins map[string]*types.AccountCoin,
coins map[string]*storage.AccountCoin,
) ([]*types.Transaction, error) {
logger := lbryUtils.ExtractLogger(ctx, "client")
@ -546,7 +547,7 @@ func (b *Client) parseTransactions(
continue
}
coins[op.CoinChange.CoinIdentifier.Identifier] = &types.AccountCoin{
coins[op.CoinChange.CoinIdentifier.Identifier] = &storage.AccountCoin{
Coin: &types.Coin{
CoinIdentifier: op.CoinChange.CoinIdentifier,
Amount: op.Amount,
@ -564,7 +565,7 @@ func (b *Client) parseTransactions(
func (b *Client) parseTxOperations(
tx *Transaction,
txIndex int,
coins map[string]*types.AccountCoin,
coins map[string]*storage.AccountCoin,
) ([]*types.Operation, error) {
txOps := []*types.Operation{}
@ -579,7 +580,7 @@ func (b *Client) parseTxOperations(
break
}
// Fetch the *types.AccountCoin the input is associated with
// Fetch the *storage.AccountCoin the input is associated with
accountCoin, ok := coins[CoinIdentifier(input.TxHash, input.Vout)]
if !ok {
return nil, fmt.Errorf(
@ -718,7 +719,7 @@ func (b *Client) parseInputTransactionOperation(
input *Input,
index int64,
networkIndex int64,
accountCoin *types.AccountCoin,
accountCoin *storage.AccountCoin,
) (*types.Operation, error) {
metadata, err := input.Metadata()
if err != nil {

View file

@ -24,6 +24,7 @@ import (
"net/http/httptest"
"testing"
"github.com/coinbase/rosetta-sdk-go/storage"
"github.com/coinbase/rosetta-sdk-go/types"
"github.com/stretchr/testify/assert"
)
@ -707,14 +708,14 @@ func mustMarshalMap(v interface{}) map[string]interface{} {
func TestParseBlock(t *testing.T) {
tests := map[string]struct {
block *Block
coins map[string]*types.AccountCoin
coins map[string]*storage.AccountCoin
expectedBlock *types.Block
expectedError error
}{
"no fetched transactions": {
block: block1000,
coins: map[string]*types.AccountCoin{},
coins: map[string]*storage.AccountCoin{},
expectedBlock: &types.Block{
BlockIdentifier: blockIdentifier1000,
ParentBlockIdentifier: &types.BlockIdentifier{
@ -864,7 +865,7 @@ func TestParseBlock(t *testing.T) {
},
"block 100000": {
block: block100000,
coins: map[string]*types.AccountCoin{
coins: map[string]*storage.AccountCoin{
"87a157f3fd88ac7907c05fc55e271dc4acdc5605d187d646604ca8c0e9382e03:0": {
Account: &types.AccountIdentifier{
Address: "1BNwxHGaFbeUBitpjy2AsKpJ29Ybxntqvb",
@ -1250,7 +1251,7 @@ func TestParseBlock(t *testing.T) {
},
"missing transactions": {
block: block100000,
coins: map[string]*types.AccountCoin{},
coins: map[string]*storage.AccountCoin{},
expectedError: errors.New("error finding previous tx"),
},
}

View file

@ -9,6 +9,8 @@ import (
mock "github.com/stretchr/testify/mock"
storage "github.com/coinbase/rosetta-sdk-go/storage"
types "github.com/coinbase/rosetta-sdk-go/types"
)
@ -73,11 +75,11 @@ func (_m *Client) NetworkStatus(_a0 context.Context) (*types.NetworkStatusRespon
}
// ParseBlock provides a mock function with given fields: _a0, _a1, _a2
func (_m *Client) ParseBlock(_a0 context.Context, _a1 *bitcoin.Block, _a2 map[string]*types.AccountCoin) (*types.Block, error) {
func (_m *Client) ParseBlock(_a0 context.Context, _a1 *lbry.Block, _a2 map[string]*storage.AccountCoin) (*types.Block, error) {
ret := _m.Called(_a0, _a1, _a2)
var r0 *types.Block
if rf, ok := ret.Get(0).(func(context.Context, *bitcoin.Block, map[string]*types.AccountCoin) *types.Block); ok {
if rf, ok := ret.Get(0).(func(context.Context, *lbry.Block, map[string]*storage.AccountCoin) *types.Block); ok {
r0 = rf(_a0, _a1, _a2)
} else {
if ret.Get(0) != nil {
@ -86,7 +88,7 @@ func (_m *Client) ParseBlock(_a0 context.Context, _a1 *bitcoin.Block, _a2 map[st
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *bitcoin.Block, map[string]*types.AccountCoin) error); ok {
if rf, ok := ret.Get(1).(func(context.Context, *lbry.Block, map[string]*storage.AccountCoin) error); ok {
r1 = rf(_a0, _a1, _a2)
} else {
r1 = ret.Error(1)

View file

@ -69,7 +69,7 @@ func TestAccountBalance_Online_Current(t *testing.T) {
"GetBalance",
ctx,
account,
bitcoin.MainnetCurrency,
lbry.MainnetCurrency,
(*types.PartialBlockIdentifier)(nil),
).Return(amount, block, nil).Once()
bal, err := servicer.AccountBalance(ctx, &types.AccountBalanceRequest{

View file

@ -27,7 +27,7 @@ import (
)
var (
middlewareVersion = "0.0.8"
middlewareVersion = "0.0.7"
defaultNetworkOptions = &types.NetworkOptionsResponse{
Version: &types.Version{
RosettaVersion: types.RosettaAPIVersion,

View file

@ -25,7 +25,7 @@ import (
const (
// NodeVersion is the version of
// lbry core we are using.
NodeVersion = "0.19.1.2"
NodeVersion = "0.17.4.6"
// HistoricalBalanceLookup indicates
// that historical balance lookup is supported.
@ -45,7 +45,7 @@ const (
// variable instead of a constant because
// we typically need the pointer of this
// value.
MiddlewareVersion = "0.0.8"
MiddlewareVersion = "0.0.7"
)
// Client is used by the servicers to get Peer information