The goal of this issue is to ensure that the proxy charges up front an amount sufficient to complete the retrieval. My suggested approach:
Create a new wallet with exactly 0.5 FIL (lotus wallet new, then lotus send --from <your main wallet> <new wallet> 0.2)
Set the new wallet with 0.5 FIL as the default wallet (lotus wallet set-default ....)
Do a command line lotus client retrieve --miner f019243 <CID> /tmp/discard-<CID> on:
the 1 MB CID
the 105 MB CID
the 1 GB CID
For each one, write down the before and after balances of the new wallet with lotus wallet balance ...
See if you can figure out how, if at all, this correlates to the price we get from ClientQueryAsk api on each cid. It'll probably be a y = mx + b type of relation
If you can figure out a reasonable function that will always price a CID correctly based on the size reported by ClientQueryAsk(cid), then use that to compute how much the retrieval proxy should request from the browser up front
If there is no clear function that works across all these sizes, then fall back to this strategy"
In the proxy_retrieval code, when you get the CID size, round it up to the nearest GB.
Charge this amount to the browser up front: (the 1GB price) * (the CID size rounded up the nearest GB)
The goal of this issue is to ensure that the proxy charges up front an amount sufficient to complete the retrieval. My suggested approach:
lotus wallet new
, thenlotus send --from <your main wallet> <new wallet> 0.2
)lotus wallet set-default ....
)lotus client retrieve --miner f019243 <CID> /tmp/discard-<CID>
on:lotus wallet balance ...
y = mx + b
type of relation