@@ -40,8 +40,8 @@ def fetch(url):
4040
4141
4242@plugin .init ()
43- def init (plugin , options , configuration , ** kwargs ):
44- plugin .api_endpoint = options [ "sauron-api-endpoint" ]
43+ def init (plugin , options , ** kwargs ):
44+ plugin .api_endpoint = options . get ( "sauron-api-endpoint" , None )
4545 if not plugin .api_endpoint :
4646 raise SauronError ("You need to specify the sauron-api-endpoint option." )
4747 sys .exit (1 )
@@ -55,7 +55,8 @@ def init(plugin, options, configuration, **kwargs):
5555 }
5656 plugin .log ("Using proxy {} for requests" .format (socks5_proxy ))
5757
58- plugin .log ("Sauron plugin initialized" )
58+ api = "mempool.space" if "mutinynet.com" in plugin .api_endpoint else "Esplora"
59+ plugin .log (f"Sauron plugin initialized using { api } API" )
5960 plugin .log (sauron_eye )
6061
6162
@@ -193,7 +194,7 @@ def estimatefees(plugin, **kwargs):
193194 feerate_req = fetch (feerate_url )
194195 assert feerate_req .status_code == 200
195196 feerates = feerate_req .json ()
196- if plugin .sauron_network == "test" or plugin . sauron_network == "signet" :
197+ if plugin .sauron_network in [ "test" , "signet" ] :
197198 # FIXME: remove the hack if the test API is "fixed"
198199 feerate = feerates .get ("144" , 1 )
199200 slow = normal = urgent = very_urgent = int (feerate * 10 ** 3 )
@@ -204,7 +205,7 @@ def estimatefees(plugin, **kwargs):
204205 urgent = int (feerates ["6" ] * 10 ** 3 )
205206 very_urgent = int (feerates ["2" ] * 10 ** 3 )
206207
207- feerate_floor = int (feerates [ "1008" ] * 10 ** 3 )
208+ feerate_floor = int (feerates . get ( "1008" , slow ) * 10 ** 3 )
208209 feerates = [
209210 {"blocks" : 2 , "feerate" : very_urgent },
210211 {"blocks" : 6 , "feerate" : urgent },
@@ -229,15 +230,15 @@ def estimatefees(plugin, **kwargs):
229230plugin .add_option (
230231 "sauron-api-endpoint" ,
231232 "" ,
232- "The URL of the esplora instance to hit (including '/api')." ,
233+ "The URL of the esplora or mempool.space instance to hit (including '/api')." ,
233234)
234235
235236plugin .add_option (
236237 "sauron-tor-proxy" ,
237238 "" ,
238239 "Tor's SocksPort address in the form address:port, don't specify the"
239240 " protocol. If you didn't modify your torrc you want to put"
240- "'localhost:9050' here." ,
241+ " 'localhost:9050' here." ,
241242)
242243
243244
0 commit comments