diff --git a/bin/hushlist b/bin/hushlist index a5ef1b1..2a137a1 100755 --- a/bin/hushlist +++ b/bin/hushlist @@ -23,7 +23,8 @@ print "Hushlist running on $blockchain ${chain}net, $blocks blocks\n"; print "Balances: transparent $tbalance HUSH, private $zbalance HUSH\n"; # we only need one -my $list = Hush::List->new; +my $options = {}; +my $list = Hush::List->new($rpc, $options); my $command = shift || help(); my $COMMANDS = { "add" => \&add, diff --git a/lib/Hush/List.pm b/lib/Hush/List.pm index 369a7c8..5fcb567 100644 --- a/lib/Hush/List.pm +++ b/lib/Hush/List.pm @@ -14,6 +14,7 @@ my $MAX_RECIPIENTS = 54; my $HUSH_CONFIG_DIR = $ENV{HUSH_CONFIG_DIR} || catdir($ENV{HOME},'.hush'); my $HUSHLIST_CONFIG_DIR = $ENV{HUSH_CONFIG_DIR} || catdir($HUSH_CONFIG_DIR, 'list'); our $VERSION = 20171031; + my $rpc = Hush::RPC->new; sub _sanity_checks { @@ -75,9 +76,8 @@ sub create_default_conf { } sub new { - my ($options) = @_; + my ($rpc,$options) = @_; my $hush_list = {}; - my $rpc = Hush::RPC->new($options); # we only need a single RPC connection $hush_list->{rpc} = $rpc; diff --git a/lib/Hush/RPC.pm b/lib/Hush/RPC.pm index 27d570f..d63609c 100644 --- a/lib/Hush/RPC.pm +++ b/lib/Hush/RPC.pm @@ -20,7 +20,16 @@ sub new { if ($info) { return $rpc, } else { - barf "Unable to make RPC connection to $host:$port !"; + my $coins = { + 8822 => 'HUSH', + 18822 => 'TUSH', + 8232 => 'ZEC', + 18232 => 'TAZ', + }; + my $coin = $coins->{$port} || 'cryptocoin'; + print "Unable to make RPC connection to $coin full node at $host:$port !\n"; + print "Your $coin full node is not running, or not accessible at that port :(\n"; + exit(1); } }