lotus_fountain: add facuet distribution amount flag
This commit is contained in:
parent
89a6b6842c
commit
f18bef867e
@ -37,8 +37,6 @@ import (
|
|||||||
|
|
||||||
var log = logging.Logger("main")
|
var log = logging.Logger("main")
|
||||||
|
|
||||||
var sendPerRequest, _ = types.ParseFIL("50")
|
|
||||||
|
|
||||||
var supportedSectors struct {
|
var supportedSectors struct {
|
||||||
SectorSizes []struct {
|
SectorSizes []struct {
|
||||||
Name string
|
Name string
|
||||||
@ -114,8 +112,18 @@ var runCmd = &cli.Command{
|
|||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "from",
|
Name: "from",
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "amount",
|
||||||
|
EnvVars: []string{"LOTUS_FOUNTAIN_AMOUNT"},
|
||||||
|
Value: "50",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
|
sendPerRequest, err := types.ParseFIL(cctx.String("amount"))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
nodeApi, closer, err := lcli.GetFullNodeAPI(cctx)
|
nodeApi, closer, err := lcli.GetFullNodeAPI(cctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -141,9 +149,10 @@ var runCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
h := &handler{
|
h := &handler{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
api: nodeApi,
|
api: nodeApi,
|
||||||
from: from,
|
from: from,
|
||||||
|
sendPerRequest: sendPerRequest,
|
||||||
limiter: NewLimiter(LimiterConfig{
|
limiter: NewLimiter(LimiterConfig{
|
||||||
TotalRate: time.Second,
|
TotalRate: time.Second,
|
||||||
TotalBurst: 256,
|
TotalBurst: 256,
|
||||||
@ -185,7 +194,8 @@ type handler struct {
|
|||||||
ctx context.Context
|
ctx context.Context
|
||||||
api api.FullNode
|
api api.FullNode
|
||||||
|
|
||||||
from address.Address
|
from address.Address
|
||||||
|
sendPerRequest types.FIL
|
||||||
|
|
||||||
limiter *Limiter
|
limiter *Limiter
|
||||||
minerLimiter *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{
|
smsg, err := h.api.MpoolPushMessage(h.ctx, &types.Message{
|
||||||
Value: types.BigInt(sendPerRequest),
|
Value: types.BigInt(h.sendPerRequest),
|
||||||
From: h.from,
|
From: h.from,
|
||||||
To: to,
|
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{
|
smsg, err := h.api.MpoolPushMessage(h.ctx, &types.Message{
|
||||||
Value: types.BigInt(sendPerRequest),
|
Value: types.BigInt(h.sendPerRequest),
|
||||||
From: h.from,
|
From: h.from,
|
||||||
To: owner,
|
To: owner,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user