Browse Source

Start adding support for KMD and better error checking in hushlist-send-file

master
Duke Leto 6 years ago
parent
commit
d5a3df1b88
  1. 5
      bin/hushlist-send-file
  2. 5
      lib/Hush/Util.pm

5
bin/hushlist-send-file

@ -15,9 +15,14 @@ use JSON;
my ($from,$to,$filename,$amount) = @ARGV;
$amount ||= 0.0;
# this is for Sprout, Sapling will not have a limit except for block size(!)
my $max_size = 512 * 54 - 54;
die "You must specify a filename!" unless $filename;
die "File does not exist!" unless -e $filename;
my $filesize = -s $filename;
die "File is empty!" unless $filesize;
die "Currently this tool only supports files which fit in one transaction, up to $max_size bytes. Patches welcome!" unless ($filesize <= $max_size);
my $memo = read_file($filename);
my $length = length $memo;

5
lib/Hush/Util.pm

@ -25,6 +25,7 @@ sub is_valid_zaddr {
#warn "zaddr=$z";
# TODO: only base58 is valid
# TODO: support Zcash Sapling addresses
if ($z =~ m/^zc[a-z0-9]{93}$/i) {
return 1;
} else {
@ -37,8 +38,11 @@ sub is_valid_taddr {
my ($t) = @_;
# TODO: only base58 is valid
# HUSH/ZEC and most zec forks
if ($t =~ m/^t1[a-z0-9]{33}$/i) {
return 1;
} elsif ($t =~ m/^R[a-z0-9]{34}$/i) { # KMD and KMD asset chains
return 1;
} else {
return 0;
}
@ -48,6 +52,7 @@ sub is_valid_taddr {
sub is_valid_privkey {
my ($p) = @_;
$p =~ s!^hushlist://!!g;
# TODO: support KMD + new Sapling privkeys
if ($p =~ m/^SK[a-z0-9]{53}$/i) {
return 1;
} else {

Loading…
Cancel
Save