Commit Graph

70 Commits

Author SHA1 Message Date
Alekos Filini
e3aa6a5a73
Release 0.7.0
Some checks failed
CI / Test (push) Has been cancelled
2021-02-22 15:11:17 +01:00
Alekos Filini
f30be3bfde
Add a test for connection timeouts 2021-02-22 14:51:25 +01:00
Alekos Filini
fa9359cf73
Implement timeouts when there are multiple socket addrs 2021-02-22 14:47:23 +01:00
Dr Maxim Orlovsky
25dc3fa5e5
Fix CI testing for all features 2021-02-22 12:56:48 +01:00
Alekos Filini
d46ba79972
Merge commit 'refs/pull/48/head' of github.com:bitcoindevkit/rust-electrum-client 2021-02-22 11:43:17 +01:00
Alekos Filini
078e513f62
Make unconfirmed an i64
Some servers like electrs return the unconfirmed balance for an address as a
negative value.

Closes #45
2021-02-22 09:49:42 +01:00
Thomas Eizinger
c8bace9407
Apply new retry logic also to re-creating client 2021-02-18 15:56:51 +11:00
Thomas Eizinger
cb9b51f356
Don't cast usize to u8 but deal with the overflow properly 2021-02-17 12:15:56 +11:00
Thomas Eizinger
2652016f99
Improve logging in case of call failure
Previously, we were logging the retry attempt before we even evaluated
whether or not we are going to retry again. Instead, we now compute
the number of failed attempts and either log and bail from the function
or inform the user that we are going to retry the call.

We also include the name of the failed call and the reason why it failed
in case we are retrying it. Once we have exhausted the the number of
retries, we return all errors anyway so there is no reason to log them.
It is up to the caller to perform error handling.
2021-02-16 11:33:13 +11:00
Thomas Eizinger
23c2004f38
Actually retry the call based on the value of config.retry
Fixes #47.
2021-02-16 11:18:18 +11:00
Alekos Filini
7db9a1331b
Merge commit 'refs/pull/37/head' of github.com:bitcoindevkit/rust-electrum-client 2021-01-25 14:35:59 -05:00
Dr. Maxim Orlovsky
d927387df3
Undo exhaustive enum type 2021-01-25 16:38:48 +01:00
Alekos Filini
1d59d9605e
Release 0.6.0
Some checks failed
CI / Test (push) Has been cancelled
2021-01-21 22:06:45 -05:00
Alekos Filini
af10aeac99
Merge commit 'refs/pull/32/head' of github.com:bitcoindevkit/rust-electrum-client 2021-01-21 09:01:27 -05:00
Dr Maxim Orlovsky
efdc7d2243
Improving error type 2021-01-21 01:49:46 +01:00
Dr Maxim Orlovsky
7d7a3088e6
Fixing calls_made fn signature 2021-01-21 00:54:25 +01:00
Dr Maxim Orlovsky
3ac7f6ec6b
Updating to rust-bitcoin 0.26 2021-01-21 00:49:16 +01:00
Alekos Filini
aacb1291a5
Release 0.5.0-beta.1
Some checks failed
CI / Test (push) Has been cancelled
2021-01-11 13:54:23 +01:00
Riccardo Casatta
8b81ad1d90
remove travis 2021-01-11 12:25:52 +01:00
Riccardo Casatta
226b12aafa
fix CI by using TargetAddr only with proxy feature 2021-01-11 12:17:15 +01:00
Riccardo Casatta
89fdf749f1
Sets the timeout as optional 2021-01-11 11:50:21 +01:00
Alekos Filini
3e266037a1
Release 0.4.0-beta.1
Some checks failed
CI / Test (push) Has been cancelled
2020-11-30 12:29:06 +01:00
Riccardo Casatta
c4735374f9
fix test_script_list_unspent by not depending on order of returned results 2020-11-27 17:07:40 +01:00
Riccardo Casatta
1a0252450c
allow missing docs on variant instead of hiding, avoid redundant clone 2020-11-27 15:38:55 +01:00
Alekos Filini
b08c59815d
Add support for TLS over socks5 proxy
Some checks failed
CI / Test (push) Has been cancelled
2020-11-27 15:13:35 +01:00
Riccardo Casatta
2477ab4440
wait with an exponential backoff capped at 1 minute 2020-11-25 15:33:12 +01:00
Riccardo Casatta
e4c72ed4bc
Propagate error also in the reader, not just in waiting threads 2020-11-25 15:33:10 +01:00
Riccardo Casatta
add53ebfa1
internal loop for client re-creation, keeping the lock 2020-11-24 15:50:09 +01:00
Riccardo Casatta
ef3ddfdabc
Pass Arc<io::Error> to waiting threads 2020-11-24 13:46:20 +01:00
Riccardo Casatta
f200b7fc61
Implements retry, timeout, socks credential and others fixes
Retry works by checking if an non-protocol error happened during the call, if so an attempt to take a write lock on the client is made and a new client attempted
if both operationare succesfull the old_client is substituted with the new one.

Timeout is a single parameter for connect,read and write TCP timeouts, special handling is required for the following situation: cannot set a timeout with a proxy and cannot set timeout with multipl SocketAddrs

Since configurations parameter grow, a Config struct with a builder has been introduced

Some new errors variant has been introduced

Errors in reading input in the reader thread now warns other eventual threads with ChannelMessage::Error

Add github actions equivalent to travis cause travis is slow
2020-11-24 12:03:51 +01:00
Nadav Ivgi
c1f4e9d76d
Allow to initialize SSL clients with an existing TcpStream 2020-11-07 03:15:07 +02:00
Alekos Filini
11c2b1b6ce
Release 0.3.0-beta.1 2020-09-30 11:28:58 +02:00
Riccardo Casatta
6f8cefd1f1
bump bitcoin version to 0.25 2020-09-30 10:23:51 +02:00
Alekos Filini
5a5fdca348
Fix conditional imports of client::* 2020-08-03 11:18:23 +02:00
Alekos Filini
3502a5c7ab
Release 0.2.0-beta.2 2020-08-03 10:18:13 +02:00
Riccardo Casatta
d5e4bfe3e7
allow Client with openssl+proxy 2020-07-31 17:58:11 +02:00
Alekos Filini
335fd49eb5
Add extra test + minor refactoring 2020-07-16 14:06:54 +02:00
Riccardo Casatta
110fff5d4f
remove from waiting_map also in case of errors 2020-07-16 14:06:51 +02:00
Alekos Filini
f9b318c1c6
New interface 2020-07-16 14:06:49 +02:00
Alekos Filini
db4554f9e2
Test against mainnet servers 2020-07-16 14:06:25 +02:00
Alekos Filini
f37bcd59e0
New multithreaded model
This new model is based on the idea of having only one thread monitor the socket and then
distribute the responses to every other thread that's waiting.

Whenever a request is made, a new mpsc channel is created and added to an internal map.
Then, if there are not other threads waiting for pending responses, that thread will
become the "reader thread" and monitor the socket until it receives the response it was
waiting for. In the meantime, if it sees responses coming on the socket with different
ids, it will lookup the correct Sender from the internal map and send that message to
the thread that created the request in the first place.

The other threads will be waiting trying to read from their Receiver, where they will
either get the message in response to their request, or a signal to wake up and
become the new "reader thread".
2020-07-16 14:06:13 +02:00
Alekos Filini
7b4e99e80c
Revert "Move to async I/O with Tokio"
This reverts commit e1dbfd7ceb.
2020-07-09 16:11:52 +02:00
Alekos Filini
2a9278879f
Revert "Fix the internal Tokio runtime for sync methods"
This reverts commit 33f4ea2e51.
2020-07-09 16:11:33 +02:00
Alekos Filini
33f4ea2e51
Fix the internal Tokio runtime for sync methods 2020-04-14 14:55:46 +02:00
Alekos Filini
e1dbfd7ceb
Move to async I/O with Tokio 2020-04-09 10:21:38 +02:00
Alekos Filini
686aafce41
Release 0.1.0-beta.6 2020-04-01 10:50:12 +02:00
Riccardo Casatta
396ab8ea57
add broadcast_transaction_raw and fix docs 2020-04-01 10:44:45 +02:00
Riccardo Casatta
e26ed29ee8
add raw methods for transactions and headers 2020-03-24 15:27:06 +01:00
Alekos Filini
c240adcd1d
Merge remote-tracking branch 'RCasatta/par_u32' 2020-03-15 15:19:20 +01:00
Alekos Filini
98b70e4791
Merge remote-tracking branch 'RCasatta/other_batches' 2020-03-15 15:14:46 +01:00