pond: +20k, +200k buttons

This commit is contained in:
Łukasz Magiera 2019-09-19 22:17:26 +02:00
parent 72e003ef9e
commit fdb45aeeaa
5 changed files with 20 additions and 19 deletions

View File

@ -70,13 +70,14 @@ func (tsc *tipSetCache) get(height uint64) (*types.TipSet, error) {
return nil, xerrors.Errorf("tipSetCache.get: requested tipset not in cache (req: %d, cache head: %d)", height, headH)
}
tailH := tsc.cache[(tsc.start-tsc.len+1)%len(tsc.cache)].Height()
clen := len(tsc.cache)
tailH := tsc.cache[((tsc.start-tsc.len+1)% clen + clen) % clen].Height()
if height < tailH {
return tsc.storage(context.TODO(), height, tsc.cache[tailH])
}
return tsc.cache[int(height-tailH+1)%len(tsc.cache)], nil
return tsc.cache[(int(height-tailH+1) % clen + clen) % clen], nil
}
func (tsc *tipSetCache) best() *types.TipSet {

View File

@ -84,16 +84,16 @@ class Address extends React.Component {
return info
}
add10k = async () => {
[...Array(10).keys()].map(() => async () => await this.props.add1k(this.props.addr)).reduce(async (p, c) => [await p, await c()], Promise.resolve(null))
add200k = async () => {
[...Array(10).keys()].map(() => async () => await this.props.add20k(this.props.addr)).reduce(async (p, c) => [await p, await c()], Promise.resolve(null))
}
render() {
let add1k = <span/>
if(this.props.add1k) {
add1k = <span>&nbsp;<a href="#" onClick={() => this.props.add1k(this.props.addr)}>[+1k]</a></span>
let add20k = <span/>
if(this.props.add20k) {
add20k = <span>&nbsp;<a href="#" onClick={() => this.props.add20k(this.props.addr)}>[+20k]</a></span>
if (this.props.add10k) {
add1k = <span>{add1k}&nbsp;<a href="#" onClick={this.add10k}>[+10k]</a></span>
add20k = <span>{add20k}&nbsp;<a href="#" onClick={this.add200k}>[+200k]</a></span>
}
}
let addr = truncAddr(this.props.addr, this.props.short ? 12 : 17)
@ -133,7 +133,7 @@ class Address extends React.Component {
minerInfo = <span>&nbsp;Power: {this.state.minerInfo.MinerPower} ({this.state.minerInfo.MinerPower/this.state.minerInfo.TotalPower*100}%)</span>
}
return <span>{addr}{balance}{actInfo}{nonce}{add1k}{transfer}{minerInfo}</span>
return <span>{addr}{balance}{actInfo}{nonce}{add20k}{transfer}{minerInfo}</span>
}
}

View File

@ -15,7 +15,7 @@ class FullNode extends React.Component {
this.newSecpAddr = this.newSecpAddr.bind(this)
this.newBLSAddr = this.newBLSAddr.bind(this)
this.startStorageMiner = this.startStorageMiner.bind(this)
this.add1k = this.add1k.bind(this)
this.add20k = this.add20k.bind(this)
this.explorer = this.explorer.bind(this)
this.client = this.client.bind(this)
this.stop = this.stop.bind(this)
@ -84,8 +84,8 @@ class FullNode extends React.Component {
this.props.spawnStorageNode(this.props.node.Repo, this.props.client)
}
async add1k(to) {
await this.props.give1k(to)
async add20k(to) {
await this.props.give20k(to)
}
explorer() {
@ -123,14 +123,14 @@ class FullNode extends React.Component {
let storageMine = <a href="#" onClick={this.startStorageMiner} hidden={!this.props.spawnStorageNode}>[Spawn Storage Miner]</a>
let addresses = this.state.addrs.map((addr) => {
let line = <Address client={this.props.client} add1k={this.add1k} add10k={true} nonce={true} addr={addr} mountWindow={this.props.mountWindow}/>
let line = <Address client={this.props.client} add20k={this.add20k} add10k={true} nonce={true} addr={addr} mountWindow={this.props.mountWindow}/>
if (this.state.defaultAddr === addr) {
line = <b>{line}</b>
}
return <div key={addr}>{line}</div>
})
let paychannels = this.state.paychs.map((addr, ak) => {
const line = <Address client={this.props.client} add1k={this.add1k} add10k={true} addr={addr} mountWindow={this.props.mountWindow}/>
const line = <Address client={this.props.client} add20k={this.add20k} add10k={true} addr={addr} mountWindow={this.props.mountWindow}/>
const vouchers = this.state.vouchers[ak].map(voucher => {
let extra = <span></span>
if(voucher.Extra) {

View File

@ -27,7 +27,7 @@ class NodeList extends React.Component {
this.spawnStorageNode = this.spawnStorageNode.bind(this)
this.connMgr = this.connMgr.bind(this)
this.consensus = this.consensus.bind(this)
this.transfer1kFrom1 = this.transfer1kFrom1.bind(this)
this.transfer20kFrom1 = this.transfer20kFrom1.bind(this)
this.getNodes()
}
@ -52,7 +52,7 @@ class NodeList extends React.Component {
node={{...node}}
client={client}
pondClient={this.props.client}
give1k={this.transfer1kFrom1}
give20k={this.transfer20kFrom1}
mountWindow={this.props.mountWindow}
spawnStorageNode={this.spawnStorageNode}
stop={this.stopNode(node.ID, onClose)}
@ -81,7 +81,7 @@ class NodeList extends React.Component {
this.setState({existingLoaded: true, nodes: nodes})
}
async transfer1kFrom1(to) {
async transfer20kFrom1(to) {
const addrss = await this.state.nodes[1].conn.call('Filecoin.WalletList', [])
const [bestaddr, bal] = await addrss.map(async addr => {
let balance = 0
@ -96,7 +96,7 @@ class NodeList extends React.Component {
await pushMessage(this.state.nodes[1].conn, bestaddr, {
To: to,
From: bestaddr,
Value: "1000",
Value: "20000",
})
}

View File

@ -194,7 +194,7 @@ func (m *Miner) schedulePoSt(ctx context.Context, baseTs *types.TipSet) {
m.schedLk.Lock()
if m.postSched >= ppe {
log.Warn("schedulePoSt already called for proving period >= %d", m.postSched)
log.Warnf("schedulePoSt already called for proving period >= %d", m.postSched)
m.schedLk.Unlock()
return
}