From 6098d916d79eb6634f92ab16100deb15de674e46 Mon Sep 17 00:00:00 2001 From: Igor Goldobin Date: Thu, 8 Apr 2021 18:42:52 +1000 Subject: [PATCH] [3.0.8.0] Added extra logging output param for ledger tool (#4225) * 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 --- src/AddressOwnershipTool/LedgerService.cs | 10 +++++++++- src/AddressOwnershipTool/Program.cs | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/AddressOwnershipTool/LedgerService.cs b/src/AddressOwnershipTool/LedgerService.cs index edc7930d10..e49b638afa 100644 --- a/src/AddressOwnershipTool/LedgerService.cs +++ b/src/AddressOwnershipTool/LedgerService.cs @@ -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) @@ -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"); diff --git a/src/AddressOwnershipTool/Program.cs b/src/AddressOwnershipTool/Program.cs index 0da2d94610..d88bde02d1 100644 --- a/src/AddressOwnershipTool/Program.cs +++ b/src/AddressOwnershipTool/Program.cs @@ -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"); @@ -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 {