Merge pull request #2385 from filecoin-project/feat/fountain-amount

lotus_fountain: add facuet distribution amount flag
This commit is contained in:
Łukasz Magiera 2020-07-13 13:16:19 +02:00 committed by GitHub
commit 4e987163af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,8 +37,6 @@ import (
var log = logging.Logger("main")
var sendPerRequest, _ = types.ParseFIL("50")
var supportedSectors struct {
SectorSizes []struct {
Name string
@ -114,8 +112,18 @@ var runCmd = &cli.Command{
&cli.StringFlag{
Name: "from",
},
&cli.StringFlag{
Name: "amount",
EnvVars: []string{"LOTUS_FOUNTAIN_AMOUNT"},
Value: "50",
},
},
Action: func(cctx *cli.Context) error {
sendPerRequest, err := types.ParseFIL(cctx.String("amount"))
if err != nil {
return err
}
nodeApi, closer, err := lcli.GetFullNodeAPI(cctx)
if err != nil {
return err
@ -141,9 +149,10 @@ var runCmd = &cli.Command{
}
h := &handler{
ctx: ctx,
api: nodeApi,
from: from,
ctx: ctx,
api: nodeApi,
from: from,
sendPerRequest: sendPerRequest,
limiter: NewLimiter(LimiterConfig{
TotalRate: time.Second,
TotalBurst: 256,
@ -185,7 +194,8 @@ type handler struct {
ctx context.Context
api api.FullNode
from address.Address
from address.Address
sendPerRequest types.FIL
limiter *Limiter
minerLimiter *Limiter
@ -266,7 +276,7 @@ func (h *handler) send(w http.ResponseWriter, r *http.Request) {
}
smsg, err := h.api.MpoolPushMessage(h.ctx, &types.Message{
Value: types.BigInt(sendPerRequest),
Value: types.BigInt(h.sendPerRequest),
From: h.from,
To: to,
@ -340,7 +350,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
}
smsg, err := h.api.MpoolPushMessage(h.ctx, &types.Message{
Value: types.BigInt(sendPerRequest),
Value: types.BigInt(h.sendPerRequest),
From: h.from,
To: owner,