bsvup icon indicating copy to clipboard operation
bsvup copied to clipboard

webupload.html glitch

Open xloem opened this issue 6 years ago • 3 comments

I was trying out webupload.html and for some reason it doesn't retry when the mempool is full. Maybe it has something to do with getTX and mattercloud, unsure.

[+] Verifying Tasks
MatterCloud API return Errors: 500
the transaction was rejected by network rules.

64: too-long-mempool-chain
获取TX时发生错误 Error acquring TX 5c93a513d46209c3405abab94dd8cbdeb485ad6743494364071998c566f3b350
Error: Request failed with status code 404

If it is getTX, I don't know if it's helpful to mention that I have some nascent code to use other apis at https://github.com/xloem/bitfiles/blob/master/whatsonchain.js#L38 for whatsonchain and https://github.com/xloem/bitfiles/blob/master/blockchair.js#L54 for blockchair. These apis also do transaction broadcasting.

I haven't really looked into the cause of this error yet.

I was just trying to upload webupload.html to the blockchain so it could self-host ^_^

xloem avatar Mar 28 '20 21:03 xloem

Ops, it does not actually retry. It seem that I've forgot something about retry, as you can see.

        async function broadcast() {
            await bsvup.logic.verifyTasks(tasks)
            var txs = bsvup.logic.getTXs(tasks)
            var unbroadcasted = txs
            while(unbroadcasted.length>0){
                unbroadcasted = await bsvup.api.tryBroadcastAll(txs)
                if(unbroadcasted>0){
                    console.log("Wait 120s and retry")
                    await new Promise((res,rej)=>{
                        setTimeout(res,120000)
                    })
                }
            }
            console.log("All Done!")
        }

monkeylord avatar Mar 29 '20 03:03 monkeylord

By the way, it's an old demo that access bsvup logic directly . I'll write a new demo soon.

Some usage with wrapped api like

var builder = new bsvup()
  .setPrivkey(key)
  .addFile({buf: filebuf, mime: "application/json"},"filename.txt")
var fee = await builder.estimateFee()
var txs = await builder.buildTXs()

may be better

monkeylord avatar Mar 29 '20 03:03 monkeylord

I wrote part of that code. It's intended to retry after the await new Promise line that sets a delay. I think it's supposed to be in a loop.

I've been exploring https://siasky.net which is like bico.media for siacoin.

xloem avatar Mar 31 '20 23:03 xloem