pond: +20k, +200k buttons
This commit is contained in:
parent
72e003ef9e
commit
fdb45aeeaa
@ -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)
|
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 {
|
if height < tailH {
|
||||||
return tsc.storage(context.TODO(), height, tsc.cache[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 {
|
func (tsc *tipSetCache) best() *types.TipSet {
|
||||||
|
@ -84,16 +84,16 @@ class Address extends React.Component {
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
add10k = async () => {
|
add200k = async () => {
|
||||||
[...Array(10).keys()].map(() => async () => await this.props.add1k(this.props.addr)).reduce(async (p, c) => [await p, await c()], Promise.resolve(null))
|
[...Array(10).keys()].map(() => async () => await this.props.add20k(this.props.addr)).reduce(async (p, c) => [await p, await c()], Promise.resolve(null))
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let add1k = <span/>
|
let add20k = <span/>
|
||||||
if(this.props.add1k) {
|
if(this.props.add20k) {
|
||||||
add1k = <span> <a href="#" onClick={() => this.props.add1k(this.props.addr)}>[+1k]</a></span>
|
add20k = <span> <a href="#" onClick={() => this.props.add20k(this.props.addr)}>[+20k]</a></span>
|
||||||
if (this.props.add10k) {
|
if (this.props.add10k) {
|
||||||
add1k = <span>{add1k} <a href="#" onClick={this.add10k}>[+10k]</a></span>
|
add20k = <span>{add20k} <a href="#" onClick={this.add200k}>[+200k]</a></span>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let addr = truncAddr(this.props.addr, this.props.short ? 12 : 17)
|
let addr = truncAddr(this.props.addr, this.props.short ? 12 : 17)
|
||||||
@ -133,7 +133,7 @@ class Address extends React.Component {
|
|||||||
minerInfo = <span> Power: {this.state.minerInfo.MinerPower} ({this.state.minerInfo.MinerPower/this.state.minerInfo.TotalPower*100}%)</span>
|
minerInfo = <span> 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>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class FullNode extends React.Component {
|
|||||||
this.newSecpAddr = this.newSecpAddr.bind(this)
|
this.newSecpAddr = this.newSecpAddr.bind(this)
|
||||||
this.newBLSAddr = this.newBLSAddr.bind(this)
|
this.newBLSAddr = this.newBLSAddr.bind(this)
|
||||||
this.startStorageMiner = this.startStorageMiner.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.explorer = this.explorer.bind(this)
|
||||||
this.client = this.client.bind(this)
|
this.client = this.client.bind(this)
|
||||||
this.stop = this.stop.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)
|
this.props.spawnStorageNode(this.props.node.Repo, this.props.client)
|
||||||
}
|
}
|
||||||
|
|
||||||
async add1k(to) {
|
async add20k(to) {
|
||||||
await this.props.give1k(to)
|
await this.props.give20k(to)
|
||||||
}
|
}
|
||||||
|
|
||||||
explorer() {
|
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 storageMine = <a href="#" onClick={this.startStorageMiner} hidden={!this.props.spawnStorageNode}>[Spawn Storage Miner]</a>
|
||||||
|
|
||||||
let addresses = this.state.addrs.map((addr) => {
|
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) {
|
if (this.state.defaultAddr === addr) {
|
||||||
line = <b>{line}</b>
|
line = <b>{line}</b>
|
||||||
}
|
}
|
||||||
return <div key={addr}>{line}</div>
|
return <div key={addr}>{line}</div>
|
||||||
})
|
})
|
||||||
let paychannels = this.state.paychs.map((addr, ak) => {
|
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 => {
|
const vouchers = this.state.vouchers[ak].map(voucher => {
|
||||||
let extra = <span></span>
|
let extra = <span></span>
|
||||||
if(voucher.Extra) {
|
if(voucher.Extra) {
|
||||||
|
@ -27,7 +27,7 @@ class NodeList extends React.Component {
|
|||||||
this.spawnStorageNode = this.spawnStorageNode.bind(this)
|
this.spawnStorageNode = this.spawnStorageNode.bind(this)
|
||||||
this.connMgr = this.connMgr.bind(this)
|
this.connMgr = this.connMgr.bind(this)
|
||||||
this.consensus = this.consensus.bind(this)
|
this.consensus = this.consensus.bind(this)
|
||||||
this.transfer1kFrom1 = this.transfer1kFrom1.bind(this)
|
this.transfer20kFrom1 = this.transfer20kFrom1.bind(this)
|
||||||
|
|
||||||
this.getNodes()
|
this.getNodes()
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ class NodeList extends React.Component {
|
|||||||
node={{...node}}
|
node={{...node}}
|
||||||
client={client}
|
client={client}
|
||||||
pondClient={this.props.client}
|
pondClient={this.props.client}
|
||||||
give1k={this.transfer1kFrom1}
|
give20k={this.transfer20kFrom1}
|
||||||
mountWindow={this.props.mountWindow}
|
mountWindow={this.props.mountWindow}
|
||||||
spawnStorageNode={this.spawnStorageNode}
|
spawnStorageNode={this.spawnStorageNode}
|
||||||
stop={this.stopNode(node.ID, onClose)}
|
stop={this.stopNode(node.ID, onClose)}
|
||||||
@ -81,7 +81,7 @@ class NodeList extends React.Component {
|
|||||||
this.setState({existingLoaded: true, nodes: nodes})
|
this.setState({existingLoaded: true, nodes: nodes})
|
||||||
}
|
}
|
||||||
|
|
||||||
async transfer1kFrom1(to) {
|
async transfer20kFrom1(to) {
|
||||||
const addrss = await this.state.nodes[1].conn.call('Filecoin.WalletList', [])
|
const addrss = await this.state.nodes[1].conn.call('Filecoin.WalletList', [])
|
||||||
const [bestaddr, bal] = await addrss.map(async addr => {
|
const [bestaddr, bal] = await addrss.map(async addr => {
|
||||||
let balance = 0
|
let balance = 0
|
||||||
@ -96,7 +96,7 @@ class NodeList extends React.Component {
|
|||||||
await pushMessage(this.state.nodes[1].conn, bestaddr, {
|
await pushMessage(this.state.nodes[1].conn, bestaddr, {
|
||||||
To: to,
|
To: to,
|
||||||
From: bestaddr,
|
From: bestaddr,
|
||||||
Value: "1000",
|
Value: "20000",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ func (m *Miner) schedulePoSt(ctx context.Context, baseTs *types.TipSet) {
|
|||||||
m.schedLk.Lock()
|
m.schedLk.Lock()
|
||||||
|
|
||||||
if m.postSched >= ppe {
|
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()
|
m.schedLk.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user