test: Add sync test for esplora and electrum#51
Conversation
thunderbiscuit
left a comment
There was a problem hiding this comment.
Looking good! Thanks for adding those in. Just a few suggestions.
| regtestEnv.mine(2) | ||
|
|
||
| //Wait 40 second for mining to complete and for electrum to index the new blocks before scanning | ||
| Thread.sleep(40000) |
There was a problem hiding this comment.
Since this is inside a coroutine, you can use the delay() API, slightly more ergonomic. Within that your argument can then use the Duration type, so as to look like this:
delay(8.seconds)| regtestEnv.send(newAddress.toString(), 0.12345678, 2.0) | ||
| regtestEnv.mine(2) | ||
|
|
||
| //Wait 40 second for mining to complete and for electrum to index the new blocks before scanning |
There was a problem hiding this comment.
In my local tests I can easily bring it down to 8 seconds. Does that work for you too? I think 40 is too much probably.
Worth noting that it would be great to have some better way to deal with this, either here or in the regtest-toolbox library (we can open up an issue there maybe?).
There was a problem hiding this comment.
Worth noting that it would be great to have some better way to deal with this, either here or in the regtest-toolbox library (we can open up an issue there maybe?).
I agree. (I have a few thoughts)
| regtestEnv.mine(2) | ||
|
|
||
| //Wait 40 second for mining to complete and for esplora to index the new blocks before scanning | ||
| Thread.sleep(40000) |
There was a problem hiding this comment.
Same as the Electrum test. I think delay(X.seconds) would work nicely here, and we can bring it down a bit from the 40 probably.
| wallet.persist(conn) | ||
|
|
||
| val balance = wallet.balance().total.toSat() | ||
| assert(balance > 0uL) |
There was a problem hiding this comment.
A nice message returning the balance would be good I think. Something like:
assert(balance > 0uL)
"Balance should be greater than zero, but was $balance"
}72c6787 to
f299cca
Compare
This pr addresses #44