Skip to content

fix/rpc-validateaddress#25

Open
DanGould wants to merge 3 commits intomasterfrom
stratis-tumblebit
Open

fix/rpc-validateaddress#25
DanGould wants to merge 3 commits intomasterfrom
stratis-tumblebit

Conversation

@DanGould
Copy link
Copy Markdown
Contributor

@DanGould DanGould commented Jan 17, 2018

  • Includes configuration to run Breeze.BreezeServer on StratisMain, StratisTest, & StratisRegTest
  • Changes RPCArgs to use NBitcoin.RPCClient ValidateAddress
  • Breeze.BreezeServer now runs on SBFN/Stratis.StratisD until breaks on DumpPrivKey rpc
  • requires changes from StratisBitcoinFullNode#1047 & StratisBitcoinFullNode#1072

@zeptin
Copy link
Copy Markdown
Contributor

zeptin commented Jan 18, 2018

Great, I think you should probably continue working on this in a separate branch for the time being.

Are the build errors due to the required changes you refer to?

bitcoinNetwork = "StratisTest";
else if (TumblerNetwork == Network.StratisRegTest)
bitcoinNetwork = "StratisRegTest";
else if (TumblerNetwork == Network.Main)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we able to get the network name as a string in a cleaner way than checking against every type?

{
var address = new Key().PubKey.GetAddress(network);
var isValid = ((JObject)rpcClient.SendCommand("validateaddress", address.ToString()).Result)["isvalid"].Value<bool>();
var isValid = rpcClient.ValidateAddress(address).IsValid;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanGould if you fix the RPCClient on the FullNode side, this will be:

var isValid = rpcClient.ValidateAddress(address);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanGould but the code here is already MUCH cleaner. Good job 👍

Copy link
Copy Markdown

@fassadlr fassadlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment re FullNode changes.

if (configFile.GetOrDefault<string>("network", "testnet").Equals("stratismain"))
{
TumblerNetwork = Network.StratisMain;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be converted from 3 ifs to if->else if -> else if or for a cleaner code to a switch statement. There is no need to test all conditions if one of the succeeds

else if (breezeConfig.TumblerNetwork == Network.StratisTest)
argsTemp.Add("-stratistest");
else if (breezeConfig.TumblerNetwork == Network.StratisRegTest)
argsTemp.Add("-stratisregtest");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like we need some sort of extension method for a Network enum so that we can put that logic into one place and replace all this code with just argsTemp.Add(breezeConfig.TumblerNetwork.ToSuffix()) or something along those lines. Same for bitcoin network string above. Something like bitcoinNetwork = TumblerNetwork.ToNamedString() would be cleaner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants