v1.27.0-a #10

Closed
jonathanface wants to merge 473 commits from v1.27.0-a into master
4 changed files with 42 additions and 0 deletions
Showing only changes of commit 8e4ce10708 - Show all commits

View File

@ -33,6 +33,8 @@ type actorInfo struct {
QualityAdjustedPower string
RawBytePower string
ActorBalance, ActorAvailable, WorkerBalance string
Deadlines []actorDeadline
}

View File

@ -10,6 +10,9 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/store"
"github.com/filecoin-project/lotus/chain/types"
)
@ -39,6 +42,8 @@ func (a *app) updateActor(ctx context.Context) error {
api := a.workingApi
a.rpcInfoLk.Unlock()
stor := store.ActorStore(ctx, blockstore.NewReadCachedBlockstore(blockstore.NewAPIBlockstore(a.workingApi), ChainBlockCache))
if api == nil {
log.Warnw("no working api yet")
return nil
@ -76,6 +81,16 @@ func (a *app) updateActor(ctx context.Context) error {
return xerrors.Errorf("getting deadlines: %w", err)
}
mact, err := api.StateGetActor(ctx, addr, types.EmptyTSK)
if err != nil {
return xerrors.Errorf("getting actor: %w", err)
}
mas, err := miner.Load(stor, mact)
if err != nil {
return err
}
outDls := []actorDeadline{}
for dlidx := range dls {
@ -127,12 +142,31 @@ func (a *app) updateActor(ctx context.Context) error {
outDls[pd.Index].Current = true
avail, err := mas.AvailableBalance(mact.Balance)
if err != nil {
return xerrors.Errorf("getting available balance: %w", err)
}
mi, err := mas.Info()
if err != nil {
return xerrors.Errorf("getting miner info: %w", err)
}
wbal, err := api.WalletBalance(ctx, mi.Worker)
if err != nil {
return xerrors.Errorf("getting worker balance: %w", err)
}
actorInfos = append(actorInfos, actorInfo{
Address: addr.String(),
CLayers: cnames,
QualityAdjustedPower: types.DeciStr(p.MinerPower.QualityAdjPower),
RawBytePower: types.DeciStr(p.MinerPower.RawBytePower),
Deadlines: outDls,
ActorBalance: types.FIL(mact.Balance).Short(),
ActorAvailable: types.FIL(avail).Short(),
WorkerBalance: types.FIL(wbal).Short(),
})
}

View File

@ -15,6 +15,9 @@
{{end}}
</div>
</td>
<td>{{.ActorBalance}}</td>
<td>{{.ActorAvailable}}</td>
<td>{{.WorkerBalance}}</td>
</tr>
{{end}}
{{end}}

View File

@ -97,6 +97,9 @@
<th>Config Layers</th>
<th>QaP</th>
<th>Deadlines</th>
<th>Balance</th>
<th>Available</th>
<th>Worker</th>
</tr>
</thead>
<tbody hx-get="/hapi/simpleinfo/actorsummary" hx-trigger="load,every 5s">