File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ use std::fs::File;
13
13
use std:: io:: { BufRead , BufReader } ;
14
14
use std:: iter:: FromIterator ;
15
15
use std:: path:: PathBuf ;
16
+ use std:: time:: Duration ;
16
17
use std:: { fmt, result} ;
17
18
18
19
use crate :: { bitcoin, deserialize_hex} ;
@@ -1288,7 +1289,16 @@ impl Client {
1288
1289
/// Can only return [Err] when using cookie authentication.
1289
1290
pub fn new ( url : & str , auth : Auth ) -> Result < Self > {
1290
1291
let ( user, pass) = auth. get_user_pass ( ) ?;
1291
- jsonrpc:: client:: Client :: simple_http ( url, user, pass)
1292
+ jsonrpc:: client:: Client :: simple_http ( url, user, pass, None )
1293
+ . map ( |client| Client {
1294
+ client,
1295
+ } )
1296
+ . map_err ( |e| super :: error:: Error :: JsonRpc ( e. into ( ) ) )
1297
+ }
1298
+
1299
+ pub fn new_with_timeout ( url : & str , auth : Auth , timeout : Duration ) -> Result < Self > {
1300
+ let ( user, pass) = auth. get_user_pass ( ) ?;
1301
+ jsonrpc:: client:: Client :: simple_http ( url, user, pass, Some ( timeout) )
1292
1302
. map ( |client| Client {
1293
1303
client,
1294
1304
} )
You can’t perform that action at this time.
0 commit comments