snet-daemon icon indicating copy to clipboard operation
snet-daemon copied to clipboard

Do not get channel state from blockchain at each call. It will save few seconds per call!

Open astroseger opened this issue 6 years ago • 3 comments

In the current version we get state of blockchain (channel.value and channel.expiration) at each call. It is free but it takes few seconds on kovan and presumably on mainnet, and it is not necessary. We should update local copy of blockchain state only then it is necessary.

astroseger avatar Dec 26 '18 22:12 astroseger

by necessary you mean if " channel is close to expiration or has expired OR insufficient funds " , only then go and fetch this again from block chain just in case the channel has been extended and /or its more funds have been added ?

anandrgitnirman avatar Apr 10 '19 05:04 anandrgitnirman

Exactly!

astroseger avatar Apr 10 '19 08:04 astroseger

Just make sure that after you've initiated claim and have increased the nonce you should subtract claimed amount from the channel value.

astroseger avatar Apr 10 '19 08:04 astroseger