Use 20 different taddrs/scriptpubs for testing dedevtax

This commit is contained in:
Duke
2023-06-28 08:46:47 -04:00
parent abb4134c06
commit da46d48f1d
2 changed files with 49 additions and 20 deletions

28
util/gen_scriptpubs.pl Executable file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/perl
# Copyright (c) 2016-2023 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
use warnings;
use strict;
use JSON;
# Generates taddrs/scriptpubs for testing the decentralized devtax
# all generated taddrs/scriptpubs will be part of existing wallet.dat
my $N = shift || 20;
my $hush = "./src/hush-cli";
my $getnew = "$hush getnewaddress";
my $validate = "$hush validateaddress";
print "std::string DEVTAX_DATA[DEVTAX_NUM][2] = {\n";
for my $i (1 .. $N) {
my $taddr = qx{$getnew};
chomp $taddr;
my $j = qx{$validate $taddr};
my $json = decode_json($j);
my $scriptpub = $json->{scriptPubKey};
printf qq!{"%s", "%s"},\n!, $taddr, $scriptpub;
}
print "};\n";