Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Commit

Permalink
[3.0.8.0] Added extra logging output param for ledger tool (#4225)
Browse files Browse the repository at this point in the history
* Added ledger support

* Fixed block explorer

* Added CL args

* Added a flag to ignore balance check

* Fixed explorer test

* Minor changes as per feedback

* Minor changes as per feedback

* Added global.json to lock the version

* DOwngraded to 2.1

* Removed unused tests

* Added keypath param for advanced users

* Fixed address scanning

* Fix for index

* Added more logs

* Added more logs

* Added logic to scan change addresses

* Added more logs

* Added ability to output signature

Co-authored-by: Igor Goldobin <[email protected]>
  • Loading branch information
fenix2222 and fenix2222 authored Apr 8, 2021
1 parent f20c9ce commit 6098d91
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/AddressOwnershipTool/LedgerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ public class LedgerService

private const int maximumInactiveAddresses = 20;

public LedgerService(bool testnet)
private bool verbose = false;

public LedgerService(bool testnet, bool verbose)
{
this.network = testnet ? new StratisTest() : new StratisMain();
this.blockExplorerClient = new BlockExplorerClient();
this.verbose = verbose;
}

public async Task ExportAddressesAsync(int numberOfAddressesToScan, string destinationAddress, bool ignoreBalance, string keyPath = null)
Expand Down Expand Up @@ -130,6 +133,11 @@ private string GetSignature(string address, byte[] resp, PubKey pubKey)
{
int recId = i;

if (this.verbose)
{
Console.WriteLine($@"Signature response from ledger: {BitConverter.ToString(resp)}");
}

if (resp[0] != (byte)(48 + recId))
continue; //throw new Exception("Unexpected signature encoding - outer type not SET");

Expand Down
4 changes: 3 additions & 1 deletion src/AddressOwnershipTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ static async Task Main(string[] args)
bool validate;
bool distribute;
bool testnet;
bool verbose;
bool ledger;
bool ignoreBalance;
string destinationAddress = null;

// Settings common between all modes
testnet = args.Contains("-testnet");
verbose = args.Contains("-verbose");
ledger = args.Contains("-ledger");
ignoreBalance = args.Contains("-ignorebalance");

Expand Down Expand Up @@ -130,7 +132,7 @@ static async Task Main(string[] args)
path = arg.Split('=')[1];
}

var ledgerService = new LedgerService(testnet);
var ledgerService = new LedgerService(testnet, verbose);

try
{
Expand Down

0 comments on commit 6098d91

Please sign in to comment.