38 lines
807 B
Go
38 lines
807 B
Go
package kit
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
|
|
"github.com/filecoin-project/go-address"
|
|
lapi "github.com/filecoin-project/lotus/api"
|
|
"github.com/filecoin-project/lotus/chain/types"
|
|
)
|
|
|
|
func SendFunds(ctx context.Context, t *testing.T, sender TestFullNode, addr address.Address, amount abi.TokenAmount) {
|
|
senderAddr, err := sender.WalletDefaultAddress(ctx)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
msg := &types.Message{
|
|
From: senderAddr,
|
|
To: addr,
|
|
Value: amount,
|
|
}
|
|
|
|
sm, err := sender.MpoolPushMessage(ctx, msg, nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
res, err := sender.StateWaitMsg(ctx, sm.Cid(), 3, lapi.LookbackNoLimit, true)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if res.Receipt.ExitCode != 0 {
|
|
t.Fatal("did not successfully send money")
|
|
}
|
|
}
|