multinode/payouts: estimated payouts added
estimated payouts for specific/all satellites added. Change-Id: I2530c9f1775593588e2a8f6c087ce6b4f9e354c4
This commit is contained in:
parent
0858c3797a
commit
a11698f370
2
go.mod
2
go.mod
@ -48,7 +48,7 @@ require (
|
|||||||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
|
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
|
||||||
google.golang.org/api v0.20.0 // indirect
|
google.golang.org/api v0.20.0 // indirect
|
||||||
gopkg.in/segmentio/analytics-go.v3 v3.1.0
|
gopkg.in/segmentio/analytics-go.v3 v3.1.0
|
||||||
storj.io/common v0.0.0-20210429174118-60091ebbbdaf
|
storj.io/common v0.0.0-20210504141454-bcb03a80052f
|
||||||
storj.io/drpc v0.0.20
|
storj.io/drpc v0.0.20
|
||||||
storj.io/monkit-jaeger v0.0.0-20210426161729-debb1cbcbbd7
|
storj.io/monkit-jaeger v0.0.0-20210426161729-debb1cbcbbd7
|
||||||
storj.io/private v0.0.0-20210511083637-239fca6e9894
|
storj.io/private v0.0.0-20210511083637-239fca6e9894
|
||||||
|
3
go.sum
3
go.sum
@ -841,8 +841,9 @@ sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2
|
|||||||
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
|
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
|
||||||
storj.io/common v0.0.0-20200424175742-65ac59022f4f/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
|
storj.io/common v0.0.0-20200424175742-65ac59022f4f/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
|
||||||
storj.io/common v0.0.0-20201026135900-1aaeec90670b/go.mod h1:GqdmNf3fLm2UZX/7Zr0BLFCJ4gFjgm6eHrk/fnmr5jQ=
|
storj.io/common v0.0.0-20201026135900-1aaeec90670b/go.mod h1:GqdmNf3fLm2UZX/7Zr0BLFCJ4gFjgm6eHrk/fnmr5jQ=
|
||||||
storj.io/common v0.0.0-20210429174118-60091ebbbdaf h1:OEKQlWDSvswTPPGOJZxSoIqyyyPGQr/rrjbN4Z5/7WA=
|
|
||||||
storj.io/common v0.0.0-20210429174118-60091ebbbdaf/go.mod h1:PdP3eTld9RqSV3E4K44JSlw7Z/zNsymj9rnKuHFKhJE=
|
storj.io/common v0.0.0-20210429174118-60091ebbbdaf/go.mod h1:PdP3eTld9RqSV3E4K44JSlw7Z/zNsymj9rnKuHFKhJE=
|
||||||
|
storj.io/common v0.0.0-20210504141454-bcb03a80052f h1:TwWEzxjvhnkCKUGds4HQKtAgFBjzf/C0hcA1luiNuKI=
|
||||||
|
storj.io/common v0.0.0-20210504141454-bcb03a80052f/go.mod h1:PdP3eTld9RqSV3E4K44JSlw7Z/zNsymj9rnKuHFKhJE=
|
||||||
storj.io/drpc v0.0.11/go.mod h1:TiFc2obNjL9/3isMW1Rpxjy8V9uE0B2HMeMFGiiI7Iw=
|
storj.io/drpc v0.0.11/go.mod h1:TiFc2obNjL9/3isMW1Rpxjy8V9uE0B2HMeMFGiiI7Iw=
|
||||||
storj.io/drpc v0.0.14/go.mod h1:82nfl+6YwRwF6UG31cEWWUqv/FaKvP5SGqUvoqTxCMA=
|
storj.io/drpc v0.0.14/go.mod h1:82nfl+6YwRwF6UG31cEWWUqv/FaKvP5SGqUvoqTxCMA=
|
||||||
storj.io/drpc v0.0.20 h1:nzOxsetLi0fJ8xCL92LPlYL0B6iYdDDk1Cpdbn0/r9Y=
|
storj.io/drpc v0.0.20 h1:nzOxsetLi0fJ8xCL92LPlYL0B6iYdDDk1Cpdbn0/r9Y=
|
||||||
|
@ -7,9 +7,11 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gorilla/mux"
|
||||||
"github.com/zeebo/errs"
|
"github.com/zeebo/errs"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
"storj.io/common/storj"
|
||||||
"storj.io/storj/multinode/payouts"
|
"storj.io/storj/multinode/payouts"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -51,6 +53,49 @@ func (controller *Payouts) GetAllNodesTotalEarned(w http.ResponseWriter, r *http
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SatelliteEstimations handles nodes estimated earnings from satellite.
|
||||||
|
func (controller *Payouts) SatelliteEstimations(w http.ResponseWriter, r *http.Request) {
|
||||||
|
ctx := r.Context()
|
||||||
|
var err error
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
segmentParams := mux.Vars(r)
|
||||||
|
id, ok := segmentParams["satelliteID"]
|
||||||
|
if !ok {
|
||||||
|
controller.serveError(w, http.StatusBadRequest, ErrPayouts.Wrap(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
satelliteID, err := storj.NodeIDFromString(id)
|
||||||
|
if err != nil {
|
||||||
|
controller.serveError(w, http.StatusBadRequest, ErrPayouts.Wrap(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
estimatedEarnings, err := controller.service.AllNodesSatelliteEstimations(ctx, satelliteID)
|
||||||
|
if err != nil {
|
||||||
|
controller.serveError(w, http.StatusInternalServerError, ErrPayouts.Wrap(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err = json.NewEncoder(w).Encode(estimatedEarnings); err != nil {
|
||||||
|
controller.log.Error("failed to write json response", zap.Error(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Estimations handles nodes estimated earnings.
|
||||||
|
func (controller *Payouts) Estimations(w http.ResponseWriter, r *http.Request) {
|
||||||
|
ctx := r.Context()
|
||||||
|
var err error
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
estimatedEarnings, err := controller.service.AllNodesEstimations(ctx)
|
||||||
|
if err != nil {
|
||||||
|
controller.serveError(w, http.StatusInternalServerError, ErrPayouts.Wrap(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err = json.NewEncoder(w).Encode(estimatedEarnings); err != nil {
|
||||||
|
controller.log.Error("failed to write json response", zap.Error(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// serveError set http statuses and send json error.
|
// serveError set http statuses and send json error.
|
||||||
func (controller *Payouts) serveError(w http.ResponseWriter, status int, err error) {
|
func (controller *Payouts) serveError(w http.ResponseWriter, status int, err error) {
|
||||||
w.WriteHeader(status)
|
w.WriteHeader(status)
|
||||||
|
@ -76,6 +76,8 @@ func NewServer(log *zap.Logger, config Config, nodes *nodes.Service, payouts *pa
|
|||||||
payoutsController := controllers.NewPayouts(server.log, server.payouts)
|
payoutsController := controllers.NewPayouts(server.log, server.payouts)
|
||||||
payoutsRouter := apiRouter.PathPrefix("/payouts").Subrouter()
|
payoutsRouter := apiRouter.PathPrefix("/payouts").Subrouter()
|
||||||
payoutsRouter.HandleFunc("/total-earned", payoutsController.GetAllNodesTotalEarned).Methods(http.MethodGet)
|
payoutsRouter.HandleFunc("/total-earned", payoutsController.GetAllNodesTotalEarned).Methods(http.MethodGet)
|
||||||
|
payoutsRouter.HandleFunc("/estimations/{satelliteID}", payoutsController.SatelliteEstimations).Methods(http.MethodGet)
|
||||||
|
payoutsRouter.HandleFunc("/estimations", payoutsController.Estimations).Methods(http.MethodGet)
|
||||||
|
|
||||||
if server.config.StaticDir != "" {
|
if server.config.StaticDir != "" {
|
||||||
router.PathPrefix("/static/").Handler(http.StripPrefix("/static", fs))
|
router.PathPrefix("/static/").Handler(http.StripPrefix("/static", fs))
|
||||||
|
@ -112,6 +112,103 @@ func (service *Service) GetAllNodesEarnedOnSatellite(ctx context.Context) (earne
|
|||||||
return earned, nil
|
return earned, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AllNodesSatelliteEstimations returns specific satellite all time estimated earnings.
|
||||||
|
func (service *Service) AllNodesSatelliteEstimations(ctx context.Context, satelliteID storj.NodeID) (_ int64, err error) {
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
|
var estimatedEarnings int64
|
||||||
|
|
||||||
|
list, err := service.nodes.List(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return 0, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, node := range list {
|
||||||
|
estimation, err := service.nodeSatelliteEstimations(ctx, node, satelliteID)
|
||||||
|
if err != nil {
|
||||||
|
return 0, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
estimatedEarnings += estimation
|
||||||
|
}
|
||||||
|
|
||||||
|
return estimatedEarnings, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllNodesEstimations returns all satellites all time estimated earnings.
|
||||||
|
func (service *Service) AllNodesEstimations(ctx context.Context) (_ int64, err error) {
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
|
var estimatedEarnings int64
|
||||||
|
|
||||||
|
list, err := service.nodes.List(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return 0, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, node := range list {
|
||||||
|
estimation, err := service.nodeEstimations(ctx, node)
|
||||||
|
if err != nil {
|
||||||
|
return 0, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
estimatedEarnings += estimation
|
||||||
|
}
|
||||||
|
|
||||||
|
return estimatedEarnings, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// nodeEstimations retrieves data from a single node.
|
||||||
|
func (service *Service) nodeEstimations(ctx context.Context, node nodes.Node) (estimation int64, err error) {
|
||||||
|
conn, err := service.dialer.DialNodeURL(ctx, storj.NodeURL{
|
||||||
|
ID: node.ID,
|
||||||
|
Address: node.PublicAddress,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return 0, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
err = errs.Combine(err, conn.Close())
|
||||||
|
}()
|
||||||
|
|
||||||
|
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
|
||||||
|
header := &multinodepb.RequestHeader{
|
||||||
|
ApiKey: node.APISecret,
|
||||||
|
}
|
||||||
|
|
||||||
|
response, err := payoutClient.EstimatedPayoutTotal(ctx, &multinodepb.EstimatedPayoutTotalRequest{Header: header})
|
||||||
|
if err != nil {
|
||||||
|
return 0, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.EstimatedEarnings, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// nodeSatelliteEstimations retrieves data from a single node.
|
||||||
|
func (service *Service) nodeSatelliteEstimations(ctx context.Context, node nodes.Node, satelliteID storj.NodeID) (estimation int64, err error) {
|
||||||
|
conn, err := service.dialer.DialNodeURL(ctx, storj.NodeURL{
|
||||||
|
ID: node.ID,
|
||||||
|
Address: node.PublicAddress,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return 0, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
err = errs.Combine(err, conn.Close())
|
||||||
|
}()
|
||||||
|
payoutClient := multinodepb.NewDRPCPayoutClient(conn)
|
||||||
|
header := &multinodepb.RequestHeader{
|
||||||
|
ApiKey: node.APISecret,
|
||||||
|
}
|
||||||
|
response, err := payoutClient.EstimatedPayoutSatellite(ctx, &multinodepb.EstimatedPayoutSatelliteRequest{Header: header, SatelliteId: satelliteID})
|
||||||
|
if err != nil {
|
||||||
|
return 0, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
return response.EstimatedEarnings, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (service *Service) getAmount(ctx context.Context, node nodes.Node) (_ int64, err error) {
|
func (service *Service) getAmount(ctx context.Context, node nodes.Node) (_ int64, err error) {
|
||||||
conn, err := service.dialer.DialNodeURL(ctx, storj.NodeURL{
|
conn, err := service.dialer.DialNodeURL(ctx, storj.NodeURL{
|
||||||
ID: node.ID,
|
ID: node.ID,
|
||||||
|
@ -689,6 +689,159 @@ func (m *TrustedSatellitesResponse_NodeURL) GetAddress() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type EstimatedPayoutSatelliteRequest struct {
|
||||||
|
Header *RequestHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
|
||||||
|
SatelliteId NodeID `protobuf:"bytes,2,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EstimatedPayoutSatelliteRequest) Reset() { *m = EstimatedPayoutSatelliteRequest{} }
|
||||||
|
func (m *EstimatedPayoutSatelliteRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EstimatedPayoutSatelliteRequest) ProtoMessage() {}
|
||||||
|
func (*EstimatedPayoutSatelliteRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{13}
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutSatelliteRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EstimatedPayoutSatelliteRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutSatelliteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EstimatedPayoutSatelliteRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutSatelliteRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EstimatedPayoutSatelliteRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutSatelliteRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EstimatedPayoutSatelliteRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutSatelliteRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EstimatedPayoutSatelliteRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EstimatedPayoutSatelliteRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EstimatedPayoutSatelliteRequest) GetHeader() *RequestHeader {
|
||||||
|
if m != nil {
|
||||||
|
return m.Header
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type EstimatedPayoutSatelliteResponse struct {
|
||||||
|
EstimatedEarnings int64 `protobuf:"varint,1,opt,name=estimated_earnings,json=estimatedEarnings,proto3" json:"estimated_earnings,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EstimatedPayoutSatelliteResponse) Reset() { *m = EstimatedPayoutSatelliteResponse{} }
|
||||||
|
func (m *EstimatedPayoutSatelliteResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EstimatedPayoutSatelliteResponse) ProtoMessage() {}
|
||||||
|
func (*EstimatedPayoutSatelliteResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{14}
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutSatelliteResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EstimatedPayoutSatelliteResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutSatelliteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EstimatedPayoutSatelliteResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutSatelliteResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EstimatedPayoutSatelliteResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutSatelliteResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EstimatedPayoutSatelliteResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutSatelliteResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EstimatedPayoutSatelliteResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EstimatedPayoutSatelliteResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EstimatedPayoutSatelliteResponse) GetEstimatedEarnings() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.EstimatedEarnings
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type EstimatedPayoutTotalRequest struct {
|
||||||
|
Header *RequestHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EstimatedPayoutTotalRequest) Reset() { *m = EstimatedPayoutTotalRequest{} }
|
||||||
|
func (m *EstimatedPayoutTotalRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EstimatedPayoutTotalRequest) ProtoMessage() {}
|
||||||
|
func (*EstimatedPayoutTotalRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{15}
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutTotalRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EstimatedPayoutTotalRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutTotalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EstimatedPayoutTotalRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutTotalRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EstimatedPayoutTotalRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutTotalRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EstimatedPayoutTotalRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutTotalRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EstimatedPayoutTotalRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EstimatedPayoutTotalRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EstimatedPayoutTotalRequest) GetHeader() *RequestHeader {
|
||||||
|
if m != nil {
|
||||||
|
return m.Header
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type EstimatedPayoutTotalResponse struct {
|
||||||
|
EstimatedEarnings int64 `protobuf:"varint,1,opt,name=estimated_earnings,json=estimatedEarnings,proto3" json:"estimated_earnings,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EstimatedPayoutTotalResponse) Reset() { *m = EstimatedPayoutTotalResponse{} }
|
||||||
|
func (m *EstimatedPayoutTotalResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EstimatedPayoutTotalResponse) ProtoMessage() {}
|
||||||
|
func (*EstimatedPayoutTotalResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{16}
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutTotalResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EstimatedPayoutTotalResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutTotalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EstimatedPayoutTotalResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutTotalResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EstimatedPayoutTotalResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutTotalResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EstimatedPayoutTotalResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EstimatedPayoutTotalResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EstimatedPayoutTotalResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EstimatedPayoutTotalResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EstimatedPayoutTotalResponse) GetEstimatedEarnings() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.EstimatedEarnings
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type EarnedRequest struct {
|
type EarnedRequest struct {
|
||||||
Header *RequestHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
|
Header *RequestHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
@ -700,7 +853,7 @@ func (m *EarnedRequest) Reset() { *m = EarnedRequest{} }
|
|||||||
func (m *EarnedRequest) String() string { return proto.CompactTextString(m) }
|
func (m *EarnedRequest) String() string { return proto.CompactTextString(m) }
|
||||||
func (*EarnedRequest) ProtoMessage() {}
|
func (*EarnedRequest) ProtoMessage() {}
|
||||||
func (*EarnedRequest) Descriptor() ([]byte, []int) {
|
func (*EarnedRequest) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_9a45fd79b06f3a1b, []int{13}
|
return fileDescriptor_9a45fd79b06f3a1b, []int{17}
|
||||||
}
|
}
|
||||||
func (m *EarnedRequest) XXX_Unmarshal(b []byte) error {
|
func (m *EarnedRequest) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_EarnedRequest.Unmarshal(m, b)
|
return xxx_messageInfo_EarnedRequest.Unmarshal(m, b)
|
||||||
@ -738,7 +891,7 @@ func (m *EarnedResponse) Reset() { *m = EarnedResponse{} }
|
|||||||
func (m *EarnedResponse) String() string { return proto.CompactTextString(m) }
|
func (m *EarnedResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*EarnedResponse) ProtoMessage() {}
|
func (*EarnedResponse) ProtoMessage() {}
|
||||||
func (*EarnedResponse) Descriptor() ([]byte, []int) {
|
func (*EarnedResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_9a45fd79b06f3a1b, []int{14}
|
return fileDescriptor_9a45fd79b06f3a1b, []int{18}
|
||||||
}
|
}
|
||||||
func (m *EarnedResponse) XXX_Unmarshal(b []byte) error {
|
func (m *EarnedResponse) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_EarnedResponse.Unmarshal(m, b)
|
return xxx_messageInfo_EarnedResponse.Unmarshal(m, b)
|
||||||
@ -776,7 +929,7 @@ func (m *EarnedPerSatelliteRequest) Reset() { *m = EarnedPerSatelliteReq
|
|||||||
func (m *EarnedPerSatelliteRequest) String() string { return proto.CompactTextString(m) }
|
func (m *EarnedPerSatelliteRequest) String() string { return proto.CompactTextString(m) }
|
||||||
func (*EarnedPerSatelliteRequest) ProtoMessage() {}
|
func (*EarnedPerSatelliteRequest) ProtoMessage() {}
|
||||||
func (*EarnedPerSatelliteRequest) Descriptor() ([]byte, []int) {
|
func (*EarnedPerSatelliteRequest) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_9a45fd79b06f3a1b, []int{15}
|
return fileDescriptor_9a45fd79b06f3a1b, []int{19}
|
||||||
}
|
}
|
||||||
func (m *EarnedPerSatelliteRequest) XXX_Unmarshal(b []byte) error {
|
func (m *EarnedPerSatelliteRequest) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_EarnedPerSatelliteRequest.Unmarshal(m, b)
|
return xxx_messageInfo_EarnedPerSatelliteRequest.Unmarshal(m, b)
|
||||||
@ -814,7 +967,7 @@ func (m *EarnedPerSatelliteResponse) Reset() { *m = EarnedPerSatelliteRe
|
|||||||
func (m *EarnedPerSatelliteResponse) String() string { return proto.CompactTextString(m) }
|
func (m *EarnedPerSatelliteResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*EarnedPerSatelliteResponse) ProtoMessage() {}
|
func (*EarnedPerSatelliteResponse) ProtoMessage() {}
|
||||||
func (*EarnedPerSatelliteResponse) Descriptor() ([]byte, []int) {
|
func (*EarnedPerSatelliteResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_9a45fd79b06f3a1b, []int{16}
|
return fileDescriptor_9a45fd79b06f3a1b, []int{20}
|
||||||
}
|
}
|
||||||
func (m *EarnedPerSatelliteResponse) XXX_Unmarshal(b []byte) error {
|
func (m *EarnedPerSatelliteResponse) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_EarnedPerSatelliteResponse.Unmarshal(m, b)
|
return xxx_messageInfo_EarnedPerSatelliteResponse.Unmarshal(m, b)
|
||||||
@ -853,7 +1006,7 @@ func (m *EarnedSatellite) Reset() { *m = EarnedSatellite{} }
|
|||||||
func (m *EarnedSatellite) String() string { return proto.CompactTextString(m) }
|
func (m *EarnedSatellite) String() string { return proto.CompactTextString(m) }
|
||||||
func (*EarnedSatellite) ProtoMessage() {}
|
func (*EarnedSatellite) ProtoMessage() {}
|
||||||
func (*EarnedSatellite) Descriptor() ([]byte, []int) {
|
func (*EarnedSatellite) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_9a45fd79b06f3a1b, []int{17}
|
return fileDescriptor_9a45fd79b06f3a1b, []int{21}
|
||||||
}
|
}
|
||||||
func (m *EarnedSatellite) XXX_Unmarshal(b []byte) error {
|
func (m *EarnedSatellite) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_EarnedSatellite.Unmarshal(m, b)
|
return xxx_messageInfo_EarnedSatellite.Unmarshal(m, b)
|
||||||
@ -897,6 +1050,10 @@ func init() {
|
|||||||
proto.RegisterType((*TrustedSatellitesRequest)(nil), "multinode.TrustedSatellitesRequest")
|
proto.RegisterType((*TrustedSatellitesRequest)(nil), "multinode.TrustedSatellitesRequest")
|
||||||
proto.RegisterType((*TrustedSatellitesResponse)(nil), "multinode.TrustedSatellitesResponse")
|
proto.RegisterType((*TrustedSatellitesResponse)(nil), "multinode.TrustedSatellitesResponse")
|
||||||
proto.RegisterType((*TrustedSatellitesResponse_NodeURL)(nil), "multinode.TrustedSatellitesResponse.NodeURL")
|
proto.RegisterType((*TrustedSatellitesResponse_NodeURL)(nil), "multinode.TrustedSatellitesResponse.NodeURL")
|
||||||
|
proto.RegisterType((*EstimatedPayoutSatelliteRequest)(nil), "multinode.EstimatedPayoutSatelliteRequest")
|
||||||
|
proto.RegisterType((*EstimatedPayoutSatelliteResponse)(nil), "multinode.EstimatedPayoutSatelliteResponse")
|
||||||
|
proto.RegisterType((*EstimatedPayoutTotalRequest)(nil), "multinode.EstimatedPayoutTotalRequest")
|
||||||
|
proto.RegisterType((*EstimatedPayoutTotalResponse)(nil), "multinode.EstimatedPayoutTotalResponse")
|
||||||
proto.RegisterType((*EarnedRequest)(nil), "multinode.EarnedRequest")
|
proto.RegisterType((*EarnedRequest)(nil), "multinode.EarnedRequest")
|
||||||
proto.RegisterType((*EarnedResponse)(nil), "multinode.EarnedResponse")
|
proto.RegisterType((*EarnedResponse)(nil), "multinode.EarnedResponse")
|
||||||
proto.RegisterType((*EarnedPerSatelliteRequest)(nil), "multinode.EarnedPerSatelliteRequest")
|
proto.RegisterType((*EarnedPerSatelliteRequest)(nil), "multinode.EarnedPerSatelliteRequest")
|
||||||
@ -907,61 +1064,67 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("multinode.proto", fileDescriptor_9a45fd79b06f3a1b) }
|
func init() { proto.RegisterFile("multinode.proto", fileDescriptor_9a45fd79b06f3a1b) }
|
||||||
|
|
||||||
var fileDescriptor_9a45fd79b06f3a1b = []byte{
|
var fileDescriptor_9a45fd79b06f3a1b = []byte{
|
||||||
// 895 bytes of a gzipped FileDescriptorProto
|
// 992 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x5f, 0x73, 0xdb, 0x44,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x51, 0x73, 0xdb, 0x44,
|
||||||
0x10, 0x47, 0x49, 0x2c, 0xd7, 0x6b, 0x37, 0x4e, 0x8e, 0xce, 0xa0, 0x88, 0xa4, 0xee, 0xa8, 0x81,
|
0x10, 0x46, 0x49, 0x2c, 0xd7, 0x6b, 0x37, 0x8e, 0x8f, 0xcc, 0xa0, 0xa8, 0x4e, 0x9d, 0x51, 0x43,
|
||||||
0x86, 0x81, 0x91, 0xc1, 0x7d, 0x62, 0x06, 0x66, 0xa8, 0x49, 0x4b, 0x33, 0xb8, 0x10, 0xe4, 0xc0,
|
0x13, 0x28, 0xd8, 0xe0, 0x3e, 0x31, 0x03, 0x33, 0xd4, 0x24, 0xa5, 0x19, 0x1c, 0x9a, 0xca, 0x81,
|
||||||
0x43, 0x99, 0xa9, 0xe7, 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, 0x35, 0xef, 0x2e, 0x72, 0x2b, 0xb6, 0x13,
|
||||||
0xef, 0xdc, 0x80, 0x52, 0x21, 0xfa, 0x87, 0xcf, 0x1d, 0x2e, 0x58, 0xf2, 0x83, 0x1b, 0xb0, 0xae,
|
0x80, 0xc9, 0xd8, 0x47, 0xf5, 0x05, 0xdb, 0x40, 0x72, 0xed, 0x2e, 0xdd, 0x15, 0xe8, 0x05, 0xd4,
|
||||||
0xfc, 0xe8, 0xc6, 0x49, 0x70, 0x49, 0x05, 0x76, 0x0b, 0xf7, 0xf8, 0xfc, 0xdc, 0x94, 0xbf, 0xc2,
|
0xe6, 0x66, 0x24, 0xba, 0xb7, 0x7c, 0x82, 0x4a, 0xe2, 0xfd, 0x37, 0x19, 0xb3, 0xed, 0xdf, 0xd6,
|
||||||
0x87, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xdd, 0x3f, 0xac, 0xd3, 0x03, 0x0a, 0x00, 0x00,
|
0x41, 0x97, 0x1f, 0x32, 0xfa, 0x02, 0x74, 0xd9, 0x6d, 0xc8, 0x98, 0x6b, 0xd2, 0x84, 0x74, 0x27,
|
||||||
|
0xc7, 0xa3, 0x32, 0xc5, 0x80, 0xe6, 0xbf, 0x08, 0xb4, 0x3f, 0x17, 0x90, 0xf3, 0xfd, 0x99, 0xef,
|
||||||
|
0x5f, 0x83, 0x52, 0x12, 0x0c, 0x8c, 0x45, 0x13, 0x12, 0x7d, 0x98, 0xa5, 0x58, 0x3e, 0xce, 0xcd,
|
||||||
|
0x07, 0x6f, 0x84, 0x55, 0xa2, 0x43, 0xd8, 0xce, 0x1b, 0x79, 0xe8, 0xfe, 0x62, 0x92, 0xec, 0x90,
|
||||||
|
0x35, 0x0f, 0xae, 0xc5, 0x49, 0xa1, 0xce, 0xfe, 0x73, 0x8b, 0x71, 0x1a, 0xfe, 0xd8, 0x74, 0x69,
|
||||||
|
0x4b, 0x3c, 0xb4, 0x82, 0xd0, 0xbd, 0xc2, 0x9c, 0xb4, 0x52, 0x82, 0xe0, 0xe2, 0x42, 0x17, 0x3f,
|
||||||
|
0x59, 0x0f, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x99, 0x4e, 0x9a, 0xfe, 0x5d, 0x0c, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,22 @@ message TrustedSatellitesResponse {
|
|||||||
service Payout {
|
service Payout {
|
||||||
rpc Earned(EarnedRequest) returns (EarnedResponse);
|
rpc Earned(EarnedRequest) returns (EarnedResponse);
|
||||||
rpc EarnedPerSatellite(EarnedPerSatelliteRequest) returns (EarnedPerSatelliteResponse);
|
rpc EarnedPerSatellite(EarnedPerSatelliteRequest) returns (EarnedPerSatelliteResponse);
|
||||||
|
rpc EstimatedPayoutSatellite(EstimatedPayoutSatelliteRequest) returns (EstimatedPayoutSatelliteResponse);
|
||||||
|
rpc EstimatedPayoutTotal(EstimatedPayoutTotalRequest) returns (EstimatedPayoutTotalResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message EstimatedPayoutSatelliteRequest {
|
||||||
|
RequestHeader header = 1;
|
||||||
|
bytes satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
||||||
|
}
|
||||||
|
message EstimatedPayoutSatelliteResponse {
|
||||||
|
int64 estimated_earnings = 1;
|
||||||
|
}
|
||||||
|
message EstimatedPayoutTotalRequest {
|
||||||
|
RequestHeader header = 1;
|
||||||
|
}
|
||||||
|
message EstimatedPayoutTotalResponse {
|
||||||
|
int64 estimated_earnings = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message EarnedRequest {
|
message EarnedRequest {
|
||||||
|
@ -389,6 +389,8 @@ type DRPCPayoutClient interface {
|
|||||||
|
|
||||||
Earned(ctx context.Context, in *EarnedRequest) (*EarnedResponse, error)
|
Earned(ctx context.Context, in *EarnedRequest) (*EarnedResponse, error)
|
||||||
EarnedPerSatellite(ctx context.Context, in *EarnedPerSatelliteRequest) (*EarnedPerSatelliteResponse, error)
|
EarnedPerSatellite(ctx context.Context, in *EarnedPerSatelliteRequest) (*EarnedPerSatelliteResponse, error)
|
||||||
|
EstimatedPayoutSatellite(ctx context.Context, in *EstimatedPayoutSatelliteRequest) (*EstimatedPayoutSatelliteResponse, error)
|
||||||
|
EstimatedPayoutTotal(ctx context.Context, in *EstimatedPayoutTotalRequest) (*EstimatedPayoutTotalResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type drpcPayoutClient struct {
|
type drpcPayoutClient struct {
|
||||||
@ -419,9 +421,29 @@ func (c *drpcPayoutClient) EarnedPerSatellite(ctx context.Context, in *EarnedPer
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *drpcPayoutClient) EstimatedPayoutSatellite(ctx context.Context, in *EstimatedPayoutSatelliteRequest) (*EstimatedPayoutSatelliteResponse, error) {
|
||||||
|
out := new(EstimatedPayoutSatelliteResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/multinode.Payout/EstimatedPayoutSatellite", drpcEncoding_File_multinode_proto{}, in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcPayoutClient) EstimatedPayoutTotal(ctx context.Context, in *EstimatedPayoutTotalRequest) (*EstimatedPayoutTotalResponse, error) {
|
||||||
|
out := new(EstimatedPayoutTotalResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/multinode.Payout/EstimatedPayoutTotal", drpcEncoding_File_multinode_proto{}, in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
type DRPCPayoutServer interface {
|
type DRPCPayoutServer interface {
|
||||||
Earned(context.Context, *EarnedRequest) (*EarnedResponse, error)
|
Earned(context.Context, *EarnedRequest) (*EarnedResponse, error)
|
||||||
EarnedPerSatellite(context.Context, *EarnedPerSatelliteRequest) (*EarnedPerSatelliteResponse, error)
|
EarnedPerSatellite(context.Context, *EarnedPerSatelliteRequest) (*EarnedPerSatelliteResponse, error)
|
||||||
|
EstimatedPayoutSatellite(context.Context, *EstimatedPayoutSatelliteRequest) (*EstimatedPayoutSatelliteResponse, error)
|
||||||
|
EstimatedPayoutTotal(context.Context, *EstimatedPayoutTotalRequest) (*EstimatedPayoutTotalResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type DRPCPayoutUnimplementedServer struct{}
|
type DRPCPayoutUnimplementedServer struct{}
|
||||||
@ -434,9 +456,17 @@ func (s *DRPCPayoutUnimplementedServer) EarnedPerSatellite(context.Context, *Ear
|
|||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *DRPCPayoutUnimplementedServer) EstimatedPayoutSatellite(context.Context, *EstimatedPayoutSatelliteRequest) (*EstimatedPayoutSatelliteResponse, error) {
|
||||||
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DRPCPayoutUnimplementedServer) EstimatedPayoutTotal(context.Context, *EstimatedPayoutTotalRequest) (*EstimatedPayoutTotalResponse, error) {
|
||||||
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12)
|
||||||
|
}
|
||||||
|
|
||||||
type DRPCPayoutDescription struct{}
|
type DRPCPayoutDescription struct{}
|
||||||
|
|
||||||
func (DRPCPayoutDescription) NumMethods() int { return 2 }
|
func (DRPCPayoutDescription) NumMethods() int { return 4 }
|
||||||
|
|
||||||
func (DRPCPayoutDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
func (DRPCPayoutDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
||||||
switch n {
|
switch n {
|
||||||
@ -458,6 +488,24 @@ func (DRPCPayoutDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver
|
|||||||
in1.(*EarnedPerSatelliteRequest),
|
in1.(*EarnedPerSatelliteRequest),
|
||||||
)
|
)
|
||||||
}, DRPCPayoutServer.EarnedPerSatellite, true
|
}, DRPCPayoutServer.EarnedPerSatellite, true
|
||||||
|
case 2:
|
||||||
|
return "/multinode.Payout/EstimatedPayoutSatellite", drpcEncoding_File_multinode_proto{},
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCPayoutServer).
|
||||||
|
EstimatedPayoutSatellite(
|
||||||
|
ctx,
|
||||||
|
in1.(*EstimatedPayoutSatelliteRequest),
|
||||||
|
)
|
||||||
|
}, DRPCPayoutServer.EstimatedPayoutSatellite, true
|
||||||
|
case 3:
|
||||||
|
return "/multinode.Payout/EstimatedPayoutTotal", drpcEncoding_File_multinode_proto{},
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCPayoutServer).
|
||||||
|
EstimatedPayoutTotal(
|
||||||
|
ctx,
|
||||||
|
in1.(*EstimatedPayoutTotalRequest),
|
||||||
|
)
|
||||||
|
}, DRPCPayoutServer.EstimatedPayoutTotal, true
|
||||||
default:
|
default:
|
||||||
return "", nil, nil, nil, false
|
return "", nil, nil, nil, false
|
||||||
}
|
}
|
||||||
@ -498,3 +546,35 @@ func (x *drpcPayout_EarnedPerSatelliteStream) SendAndClose(m *EarnedPerSatellite
|
|||||||
}
|
}
|
||||||
return x.CloseSend()
|
return x.CloseSend()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DRPCPayout_EstimatedPayoutSatelliteStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*EstimatedPayoutSatelliteResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcPayout_EstimatedPayoutSatelliteStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcPayout_EstimatedPayoutSatelliteStream) SendAndClose(m *EstimatedPayoutSatelliteResponse) error {
|
||||||
|
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCPayout_EstimatedPayoutTotalStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*EstimatedPayoutTotalResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcPayout_EstimatedPayoutTotalStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcPayout_EstimatedPayoutTotalStream) SendAndClose(m *EstimatedPayoutTotalResponse) error {
|
||||||
|
if err := x.MsgSend(m, drpcEncoding_File_multinode_proto{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
@ -41,7 +41,7 @@ func (service *Service) Issue(ctx context.Context) (apiKey APIKey, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apiKey.Secret = secret
|
apiKey.Secret = secret
|
||||||
apiKey.CreatedAt = time.Now()
|
apiKey.CreatedAt = time.Now().UTC()
|
||||||
|
|
||||||
err = service.store.Store(ctx, apiKey)
|
err = service.store.Store(ctx, apiKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -132,10 +131,6 @@ func TestStorageNodeApi(t *testing.T) {
|
|||||||
}
|
}
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// round CurrentMonthExpectations to 3 decimal places to resolve precision issues
|
|
||||||
bodyPayout.CurrentMonthExpectations = math.Round(bodyPayout.CurrentMonthExpectations*100) / 100
|
|
||||||
expectedPayout.CurrentMonthExpectations = math.Round(expectedPayout.CurrentMonthExpectations*100) / 100
|
|
||||||
|
|
||||||
require.EqualValues(t, expectedPayout, bodyPayout)
|
require.EqualValues(t, expectedPayout, bodyPayout)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -5,6 +5,7 @@ package multinode
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ import (
|
|||||||
"storj.io/storj/private/multinodepb"
|
"storj.io/storj/private/multinodepb"
|
||||||
"storj.io/storj/storagenode/apikeys"
|
"storj.io/storj/storagenode/apikeys"
|
||||||
"storj.io/storj/storagenode/payouts"
|
"storj.io/storj/storagenode/payouts"
|
||||||
|
"storj.io/storj/storagenode/payouts/estimatedpayouts"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ multinodepb.DRPCPayoutServer = (*PayoutEndpoint)(nil)
|
var _ multinodepb.DRPCPayoutServer = (*PayoutEndpoint)(nil)
|
||||||
@ -22,17 +24,19 @@ var _ multinodepb.DRPCPayoutServer = (*PayoutEndpoint)(nil)
|
|||||||
type PayoutEndpoint struct {
|
type PayoutEndpoint struct {
|
||||||
multinodepb.DRPCPayoutUnimplementedServer
|
multinodepb.DRPCPayoutUnimplementedServer
|
||||||
|
|
||||||
log *zap.Logger
|
log *zap.Logger
|
||||||
apiKeys *apikeys.Service
|
apiKeys *apikeys.Service
|
||||||
db payouts.DB
|
estimatedPayouts *estimatedpayouts.Service
|
||||||
|
db payouts.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPayoutEndpoint creates new multinode payouts endpoint.
|
// NewPayoutEndpoint creates new multinode payouts endpoint.
|
||||||
func NewPayoutEndpoint(log *zap.Logger, apiKeys *apikeys.Service, db payouts.DB) *PayoutEndpoint {
|
func NewPayoutEndpoint(log *zap.Logger, apiKeys *apikeys.Service, estimatedPayouts *estimatedpayouts.Service, db payouts.DB) *PayoutEndpoint {
|
||||||
return &PayoutEndpoint{
|
return &PayoutEndpoint{
|
||||||
log: log,
|
log: log,
|
||||||
apiKeys: apiKeys,
|
apiKeys: apiKeys,
|
||||||
db: db,
|
estimatedPayouts: estimatedPayouts,
|
||||||
|
db: db,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,3 +86,35 @@ func (payout *PayoutEndpoint) EarnedPerSatellite(ctx context.Context, req *multi
|
|||||||
|
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EstimatedPayoutTotal returns estimated earnings for current month from all satellites.
|
||||||
|
func (payout *PayoutEndpoint) EstimatedPayoutTotal(ctx context.Context, req *multinodepb.EstimatedPayoutTotalRequest) (_ *multinodepb.EstimatedPayoutTotalResponse, err error) {
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
|
if err = authenticate(ctx, payout.apiKeys, req.GetHeader()); err != nil {
|
||||||
|
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
estimated, err := payout.estimatedPayouts.GetAllSatellitesEstimatedPayout(ctx, time.Now())
|
||||||
|
if err != nil {
|
||||||
|
return &multinodepb.EstimatedPayoutTotalResponse{}, rpcstatus.Wrap(rpcstatus.Internal, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &multinodepb.EstimatedPayoutTotalResponse{EstimatedEarnings: estimated.CurrentMonthExpectations}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EstimatedPayoutSatellite returns estimated earnings for current month from specific satellite.
|
||||||
|
func (payout *PayoutEndpoint) EstimatedPayoutSatellite(ctx context.Context, req *multinodepb.EstimatedPayoutSatelliteRequest) (_ *multinodepb.EstimatedPayoutSatelliteResponse, err error) {
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
|
if err = authenticate(ctx, payout.apiKeys, req.GetHeader()); err != nil {
|
||||||
|
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
estimated, err := payout.estimatedPayouts.GetSatelliteEstimatedPayout(ctx, req.SatelliteId, time.Now())
|
||||||
|
if err != nil {
|
||||||
|
return &multinodepb.EstimatedPayoutSatelliteResponse{}, rpcstatus.Wrap(rpcstatus.Internal, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &multinodepb.EstimatedPayoutSatelliteResponse{EstimatedEarnings: estimated.CurrentMonthExpectations}, nil
|
||||||
|
}
|
||||||
|
@ -5,17 +5,48 @@ package multinode_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"go.uber.org/zap/zaptest"
|
"go.uber.org/zap/zaptest"
|
||||||
|
|
||||||
|
"storj.io/common/pb"
|
||||||
|
"storj.io/common/rpc"
|
||||||
|
"storj.io/common/storj"
|
||||||
"storj.io/common/testcontext"
|
"storj.io/common/testcontext"
|
||||||
"storj.io/common/testrand"
|
"storj.io/common/testrand"
|
||||||
"storj.io/storj/private/multinodepb"
|
"storj.io/storj/private/multinodepb"
|
||||||
"storj.io/storj/private/testplanet"
|
"storj.io/storj/private/testplanet"
|
||||||
|
"storj.io/storj/storagenode"
|
||||||
"storj.io/storj/storagenode/apikeys"
|
"storj.io/storj/storagenode/apikeys"
|
||||||
"storj.io/storj/storagenode/multinode"
|
"storj.io/storj/storagenode/multinode"
|
||||||
"storj.io/storj/storagenode/payouts"
|
"storj.io/storj/storagenode/payouts"
|
||||||
|
"storj.io/storj/storagenode/payouts/estimatedpayouts"
|
||||||
|
"storj.io/storj/storagenode/pricing"
|
||||||
|
"storj.io/storj/storagenode/reputation"
|
||||||
|
"storj.io/storj/storagenode/storagenodedb/storagenodedbtest"
|
||||||
|
"storj.io/storj/storagenode/storageusage"
|
||||||
|
"storj.io/storj/storagenode/trust"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
actions = []pb.PieceAction{
|
||||||
|
pb.PieceAction_INVALID,
|
||||||
|
|
||||||
|
pb.PieceAction_PUT,
|
||||||
|
pb.PieceAction_GET,
|
||||||
|
pb.PieceAction_GET_AUDIT,
|
||||||
|
pb.PieceAction_GET_REPAIR,
|
||||||
|
pb.PieceAction_PUT_REPAIR,
|
||||||
|
pb.PieceAction_DELETE,
|
||||||
|
|
||||||
|
pb.PieceAction_PUT,
|
||||||
|
pb.PieceAction_GET,
|
||||||
|
pb.PieceAction_GET_AUDIT,
|
||||||
|
pb.PieceAction_GET_REPAIR,
|
||||||
|
pb.PieceAction_PUT_REPAIR,
|
||||||
|
pb.PieceAction_DELETE,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEarnedPerSatellite(t *testing.T) {
|
func TestEarnedPerSatellite(t *testing.T) {
|
||||||
@ -24,7 +55,8 @@ func TestEarnedPerSatellite(t *testing.T) {
|
|||||||
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
||||||
log := zaptest.NewLogger(t)
|
log := zaptest.NewLogger(t)
|
||||||
service := apikeys.NewService(planet.StorageNodes[0].DB.APIKeys())
|
service := apikeys.NewService(planet.StorageNodes[0].DB.APIKeys())
|
||||||
endpoint := multinode.NewPayoutEndpoint(log, service, planet.StorageNodes[0].DB.Payout())
|
estimatedPayoutsService := estimatedpayouts.NewService(planet.StorageNodes[0].DB.Bandwidth(), planet.StorageNodes[0].DB.Reputation(), planet.StorageNodes[0].DB.StorageUsage(), planet.StorageNodes[0].DB.Pricing(), planet.StorageNodes[0].DB.Satellites(), &trust.Pool{})
|
||||||
|
endpoint := multinode.NewPayoutEndpoint(log, service, estimatedPayoutsService, planet.StorageNodes[0].DB.Payout())
|
||||||
|
|
||||||
var amount int64 = 200
|
var amount int64 = 200
|
||||||
|
|
||||||
@ -46,3 +78,99 @@ func TestEarnedPerSatellite(t *testing.T) {
|
|||||||
require.Equal(t, response.EarnedSatellite[0].Total, amount)
|
require.Equal(t, response.EarnedSatellite[0].Total, amount)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStorageNodeApi(t *testing.T) {
|
||||||
|
storagenodedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db storagenode.DB) {
|
||||||
|
satelliteID := testrand.NodeID()
|
||||||
|
bandwidthdb := db.Bandwidth()
|
||||||
|
pricingdb := db.Pricing()
|
||||||
|
storageusagedb := db.StorageUsage()
|
||||||
|
reputationdb := db.Reputation()
|
||||||
|
|
||||||
|
log := zaptest.NewLogger(t)
|
||||||
|
service := apikeys.NewService(db.APIKeys())
|
||||||
|
|
||||||
|
key, err := service.Issue(ctx)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
// Initialize a trust pool
|
||||||
|
poolConfig := trust.Config{
|
||||||
|
CachePath: ctx.File("trust-cache.json"),
|
||||||
|
}
|
||||||
|
poolConfig.Sources = append(poolConfig.Sources, &trust.StaticURLSource{URL: trust.SatelliteURL{ID: satelliteID}})
|
||||||
|
|
||||||
|
trustPool, err := trust.NewPool(zaptest.NewLogger(t), trust.Dialer(rpc.Dialer{}), poolConfig)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.NoError(t, trustPool.Refresh(ctx))
|
||||||
|
|
||||||
|
estimatedPayoutsService := estimatedpayouts.NewService(db.Bandwidth(), db.Reputation(), db.StorageUsage(), db.Pricing(), db.Satellites(), trustPool)
|
||||||
|
endpoint := multinode.NewPayoutEndpoint(log, service, estimatedPayoutsService, db.Payout())
|
||||||
|
|
||||||
|
now := time.Now().UTC().Add(-2 * time.Hour)
|
||||||
|
|
||||||
|
for _, action := range actions {
|
||||||
|
err := bandwidthdb.Add(ctx, satelliteID, action, 2300000000000, now)
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
var satellites []storj.NodeID
|
||||||
|
|
||||||
|
satellites = append(satellites, satelliteID)
|
||||||
|
stamps, _ := makeStorageUsageStamps(satellites)
|
||||||
|
|
||||||
|
err = storageusagedb.Store(ctx, stamps)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
err = reputationdb.Store(ctx, reputation.Stats{
|
||||||
|
SatelliteID: satelliteID,
|
||||||
|
JoinedAt: now.AddDate(0, -2, 0),
|
||||||
|
})
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
egressPrice, repairPrice, auditPrice, diskPrice := int64(2000), int64(1000), int64(1000), int64(150)
|
||||||
|
|
||||||
|
err = pricingdb.Store(ctx, pricing.Pricing{
|
||||||
|
SatelliteID: satelliteID,
|
||||||
|
EgressBandwidth: egressPrice,
|
||||||
|
RepairBandwidth: repairPrice,
|
||||||
|
AuditBandwidth: auditPrice,
|
||||||
|
DiskSpace: diskPrice,
|
||||||
|
})
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
t.Run("test EstimatedPayoutTotal", func(t *testing.T) {
|
||||||
|
estimation, err := estimatedPayoutsService.GetAllSatellitesEstimatedPayout(ctx, time.Now())
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
resp, err := endpoint.EstimatedPayoutTotal(ctx, &multinodepb.EstimatedPayoutTotalRequest{Header: &multinodepb.RequestHeader{
|
||||||
|
ApiKey: key.Secret[:],
|
||||||
|
}})
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
require.EqualValues(t, estimation.CurrentMonthExpectations, resp.EstimatedEarnings)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// makeStorageUsageStamps creates storage usage stamps and expected summaries for provided satellites.
|
||||||
|
// Creates one entry per day for 30 days with last date as beginning of provided endDate.
|
||||||
|
func makeStorageUsageStamps(satellites []storj.NodeID) ([]storageusage.Stamp, map[storj.NodeID]float64) {
|
||||||
|
var stamps []storageusage.Stamp
|
||||||
|
summary := make(map[storj.NodeID]float64)
|
||||||
|
|
||||||
|
now := time.Now().UTC().Day()
|
||||||
|
|
||||||
|
for _, satellite := range satellites {
|
||||||
|
for i := 0; i < now; i++ {
|
||||||
|
stamp := storageusage.Stamp{
|
||||||
|
SatelliteID: satellite,
|
||||||
|
AtRestTotal: 31234567891234,
|
||||||
|
IntervalStart: time.Now().UTC().Add(time.Hour * -24 * time.Duration(i)),
|
||||||
|
}
|
||||||
|
|
||||||
|
summary[satellite] += stamp.AtRestTotal
|
||||||
|
stamps = append(stamps, stamp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return stamps, summary
|
||||||
|
}
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
type EstimatedPayout struct {
|
type EstimatedPayout struct {
|
||||||
CurrentMonth PayoutMonthly `json:"currentMonth"`
|
CurrentMonth PayoutMonthly `json:"currentMonth"`
|
||||||
PreviousMonth PayoutMonthly `json:"previousMonth"`
|
PreviousMonth PayoutMonthly `json:"previousMonth"`
|
||||||
CurrentMonthExpectations float64 `json:"currentMonthExpectations"`
|
CurrentMonthExpectations int64 `json:"currentMonthExpectations"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PayoutMonthly contains usage and estimated payouts date.
|
// PayoutMonthly contains usage and estimated payouts date.
|
||||||
@ -95,11 +95,11 @@ func (estimatedPayout *EstimatedPayout) Set(current, previous PayoutMonthly, now
|
|||||||
}
|
}
|
||||||
|
|
||||||
payoutPerDay := estimatedPayout.CurrentMonth.Payout / daysPast
|
payoutPerDay := estimatedPayout.CurrentMonth.Payout / daysPast
|
||||||
estimatedPayout.CurrentMonthExpectations += payoutPerDay * daysPerMonth
|
estimatedPayout.CurrentMonthExpectations += int64(payoutPerDay * daysPerMonth)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
estimatedPayout.CurrentMonthExpectations += estimatedPayout.CurrentMonth.Payout / math.Round(daysSinceJoined) * daysPerMonth
|
estimatedPayout.CurrentMonthExpectations += int64(estimatedPayout.CurrentMonth.Payout / math.Round(daysSinceJoined) * daysPerMonth)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add adds estimate into the receiver.
|
// Add adds estimate into the receiver.
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
package estimatedpayouts_test
|
package estimatedpayouts_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ func TestCurrentMonthExpectations(t *testing.T) {
|
|||||||
|
|
||||||
type test struct {
|
type test struct {
|
||||||
time time.Time
|
time time.Time
|
||||||
expected float64
|
expected int64
|
||||||
joinedAt time.Time
|
joinedAt time.Time
|
||||||
payout estimatedpayouts.EstimatedPayout
|
payout estimatedpayouts.EstimatedPayout
|
||||||
current, previous estimatedpayouts.PayoutMonthly
|
current, previous estimatedpayouts.PayoutMonthly
|
||||||
@ -49,7 +48,7 @@ func TestCurrentMonthExpectations(t *testing.T) {
|
|||||||
Payout: payout,
|
Payout: payout,
|
||||||
Held: 901,
|
Held: 901,
|
||||||
}},
|
}},
|
||||||
{time.Date(2021, 2, 28, 10, 0, 0, 0, time.UTC), 103.70, time.Date(2021, 1, 26, 10, 0, 0, 0, time.UTC),
|
{time.Date(2021, 2, 28, 10, 0, 0, 0, time.UTC), 103, time.Date(2021, 1, 26, 10, 0, 0, 0, time.UTC),
|
||||||
estimatedpayouts.EstimatedPayout{},
|
estimatedpayouts.EstimatedPayout{},
|
||||||
estimatedpayouts.PayoutMonthly{
|
estimatedpayouts.PayoutMonthly{
|
||||||
EgressBandwidth: 123,
|
EgressBandwidth: 123,
|
||||||
@ -73,7 +72,7 @@ func TestCurrentMonthExpectations(t *testing.T) {
|
|||||||
Payout: payout,
|
Payout: payout,
|
||||||
Held: 901,
|
Held: 901,
|
||||||
}},
|
}},
|
||||||
{time.Date(2021, 2, 28, 10, 0, 0, 0, time.UTC), 215.38, time.Date(2021, 2, 15, 10, 0, 0, 0, time.UTC),
|
{time.Date(2021, 2, 28, 10, 0, 0, 0, time.UTC), 215, time.Date(2021, 2, 15, 10, 0, 0, 0, time.UTC),
|
||||||
estimatedpayouts.EstimatedPayout{},
|
estimatedpayouts.EstimatedPayout{},
|
||||||
estimatedpayouts.PayoutMonthly{
|
estimatedpayouts.PayoutMonthly{
|
||||||
EgressBandwidth: 123,
|
EgressBandwidth: 123,
|
||||||
@ -122,7 +121,7 @@ func TestCurrentMonthExpectations(t *testing.T) {
|
|||||||
Payout: payout,
|
Payout: payout,
|
||||||
Held: 901,
|
Held: 901,
|
||||||
}},
|
}},
|
||||||
{time.Date(2021, 3, 31, 21, 0, 0, 0, time.UTC), 103.33, time.Date(2021, 1, 31, 21, 0, 0, 0, time.UTC),
|
{time.Date(2021, 3, 31, 21, 0, 0, 0, time.UTC), 103, time.Date(2021, 1, 31, 21, 0, 0, 0, time.UTC),
|
||||||
estimatedpayouts.EstimatedPayout{},
|
estimatedpayouts.EstimatedPayout{},
|
||||||
estimatedpayouts.PayoutMonthly{
|
estimatedpayouts.PayoutMonthly{
|
||||||
EgressBandwidth: 123,
|
EgressBandwidth: 123,
|
||||||
@ -146,7 +145,7 @@ func TestCurrentMonthExpectations(t *testing.T) {
|
|||||||
Payout: payout,
|
Payout: payout,
|
||||||
Held: 901,
|
Held: 901,
|
||||||
}},
|
}},
|
||||||
{time.Date(2021, 3, 31, 21, 0, 0, 0, time.UTC), 193.75, time.Date(2021, 3, 15, 21, 0, 0, 0, time.UTC),
|
{time.Date(2021, 3, 31, 21, 0, 0, 0, time.UTC), 193, time.Date(2021, 3, 15, 21, 0, 0, 0, time.UTC),
|
||||||
estimatedpayouts.EstimatedPayout{},
|
estimatedpayouts.EstimatedPayout{},
|
||||||
estimatedpayouts.PayoutMonthly{
|
estimatedpayouts.PayoutMonthly{
|
||||||
EgressBandwidth: 123,
|
EgressBandwidth: 123,
|
||||||
@ -174,7 +173,6 @@ func TestCurrentMonthExpectations(t *testing.T) {
|
|||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test.payout.Set(test.current, test.previous, test.time, test.joinedAt)
|
test.payout.Set(test.current, test.previous, test.time, test.joinedAt)
|
||||||
require.False(t, math.IsNaN(test.payout.CurrentMonthExpectations))
|
|
||||||
require.InDelta(t, test.expected, test.payout.CurrentMonthExpectations, 0.01)
|
require.InDelta(t, test.expected, test.payout.CurrentMonthExpectations, 0.01)
|
||||||
require.Equal(t, test.payout.CurrentMonth, test.current)
|
require.Equal(t, test.payout.CurrentMonth, test.current)
|
||||||
require.Equal(t, test.payout.PreviousMonth, test.previous)
|
require.Equal(t, test.payout.PreviousMonth, test.previous)
|
||||||
|
@ -805,6 +805,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten
|
|||||||
peer.Multinode.Payout = multinode.NewPayoutEndpoint(
|
peer.Multinode.Payout = multinode.NewPayoutEndpoint(
|
||||||
peer.Log.Named("multinode:payout-endpoint"),
|
peer.Log.Named("multinode:payout-endpoint"),
|
||||||
apiKeys,
|
apiKeys,
|
||||||
|
peer.Estimation.Service,
|
||||||
peer.DB.Payout())
|
peer.DB.Payout())
|
||||||
|
|
||||||
if err = multinodepb.DRPCRegisterStorage(peer.Server.DRPC(), peer.Multinode.Storage); err != nil {
|
if err = multinodepb.DRPCRegisterStorage(peer.Server.DRPC(), peer.Multinode.Storage); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user