Merge pull request #1568 from filecoin-project/feat/fix-reward-redeem
fix reward redeem command to work again
This commit is contained in:
commit
f960cccc51
@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
)
|
)
|
||||||
|
|
||||||
var rewardsCmd = &cli.Command{
|
var rewardsCmd = &cli.Command{
|
||||||
@ -47,38 +47,32 @@ var rewardsRedeemCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
params, err := actors.SerializeParams(&maddr)
|
mact, err := api.StateGetActor(ctx, maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
workerNonce, err := api.MpoolGetNonce(ctx, mi.Worker)
|
params, err := actors.SerializeParams(&miner.WithdrawBalanceParams{
|
||||||
|
mact.Balance, // Default to attempting to withdraw all the extra funds in the miner actor
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
panic("todo correct method; call miner actor")
|
smsg, err := api.MpoolPushMessage(ctx, &types.Message{
|
||||||
|
To: maddr,
|
||||||
smsg, err := api.WalletSignMessage(ctx, mi.Worker, &types.Message{
|
From: mi.Owner,
|
||||||
To: builtin.RewardActorAddr,
|
|
||||||
From: mi.Worker,
|
|
||||||
Nonce: workerNonce,
|
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
GasLimit: 100000,
|
GasLimit: 100000,
|
||||||
Method: 0,
|
Method: builtin.MethodsMiner.WithdrawBalance,
|
||||||
Params: params,
|
Params: params,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
mcid, err := api.MpoolPush(ctx, smsg)
|
fmt.Printf("Requested rewards withdrawal in message %s\n", smsg.Cid())
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("Requested rewards withdrawal in message %s\n", mcid)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user