From fdb45aeeaa8b4b21d94a4ae8e434b0b0bc7afecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 19 Sep 2019 22:17:26 +0200 Subject: [PATCH] pond: +20k, +200k buttons --- chain/events/tscache.go | 5 +++-- lotuspond/front/src/Address.js | 14 +++++++------- lotuspond/front/src/FullNode.js | 10 +++++----- lotuspond/front/src/NodeList.js | 8 ++++---- storage/miner.go | 2 +- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/chain/events/tscache.go b/chain/events/tscache.go index 33493a4b8..a0d85e6e2 100644 --- a/chain/events/tscache.go +++ b/chain/events/tscache.go @@ -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 { diff --git a/lotuspond/front/src/Address.js b/lotuspond/front/src/Address.js index b41f3cdcb..64984716d 100644 --- a/lotuspond/front/src/Address.js +++ b/lotuspond/front/src/Address.js @@ -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 = - if(this.props.add1k) { - add1k =   this.props.add1k(this.props.addr)}>[+1k] + let add20k = + if(this.props.add20k) { + add20k =   this.props.add20k(this.props.addr)}>[+20k] if (this.props.add10k) { - add1k = {add1k} [+10k] + add20k = {add20k} [+200k] } } let addr = truncAddr(this.props.addr, this.props.short ? 12 : 17) @@ -133,7 +133,7 @@ class Address extends React.Component { minerInfo =  Power: {this.state.minerInfo.MinerPower} ({this.state.minerInfo.MinerPower/this.state.minerInfo.TotalPower*100}%) } - return {addr}{balance}{actInfo}{nonce}{add1k}{transfer}{minerInfo} + return {addr}{balance}{actInfo}{nonce}{add20k}{transfer}{minerInfo} } } diff --git a/lotuspond/front/src/FullNode.js b/lotuspond/front/src/FullNode.js index edf620579..29a805273 100644 --- a/lotuspond/front/src/FullNode.js +++ b/lotuspond/front/src/FullNode.js @@ -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 = let addresses = this.state.addrs.map((addr) => { - let line =
+ let line =
if (this.state.defaultAddr === addr) { line = {line} } return
{line}
}) let paychannels = this.state.paychs.map((addr, ak) => { - const line =
+ const line =
const vouchers = this.state.vouchers[ak].map(voucher => { let extra = if(voucher.Extra) { diff --git a/lotuspond/front/src/NodeList.js b/lotuspond/front/src/NodeList.js index 093a336c4..0466a5eb9 100644 --- a/lotuspond/front/src/NodeList.js +++ b/lotuspond/front/src/NodeList.js @@ -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", }) } diff --git a/storage/miner.go b/storage/miner.go index 7642b426a..2e07701bc 100644 --- a/storage/miner.go +++ b/storage/miner.go @@ -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 }