Skip to content

Commit

Permalink
Revert "Modified BechPrefix"
Browse files Browse the repository at this point in the history
This reverts commit a19e989.
  • Loading branch information
xiaolin1579 committed Oct 20, 2023
1 parent 39b17d7 commit e645b21
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
5 changes: 1 addition & 4 deletions src/Miningcore/Blockchain/Bitcoin/BitcoinJobManagerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -536,14 +536,11 @@ protected virtual IDestination AddressToDestination(string address, BitcoinAddre
switch(addressType.Value)
{
case BitcoinAddressType.BechSegwit:
return BitcoinUtils.BechSegwitAddressToDestination(poolConfig.Address, network, extraPoolConfig?.BechPrefix);
return BitcoinUtils.BechSegwitAddressToDestination(poolConfig.Address, network);

case BitcoinAddressType.BCash:
return BitcoinUtils.BCashAddressToDestination(poolConfig.Address, network);

case BitcoinAddressType.Litecoin:
return BitcoinUtils.LitecoinAddressToDestination(poolConfig.Address, network);

default:
return BitcoinUtils.AddressToDestination(poolConfig.Address, network);
}
Expand Down
17 changes: 2 additions & 15 deletions src/Miningcore/Blockchain/Bitcoin/BitcoinUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public static IDestination AddressToDestination(string address, Network expected
return result;
}

public static IDestination BechSegwitAddressToDestination(string address, Network expectedNetwork, string bechPrefix)
public static IDestination BechSegwitAddressToDestination(string address, Network expectedNetwork)
{
var encoder = Encoders.Bech32(bechPrefix);
var encoder = expectedNetwork.GetBech32Encoder(Bech32Type.WITNESS_PUBKEY_ADDRESS, true);
var decoded = encoder.Decode(address, out var witVersion);
var result = new WitKeyId(decoded);

Expand All @@ -41,17 +41,4 @@ public static IDestination BCashAddressToDestination(string address, Network exp
var trashAddress = bcash.Parse<NBitcoin.Altcoins.BCash.BTrashPubKeyAddress>(address);
return trashAddress.ScriptPubKey.GetDestinationAddress(bcash);
}

public static IDestination LitecoinAddressToDestination(string address, Network expectedNetwork)
{
var litecoin = NBitcoin.Altcoins.Litecoin.Instance.GetNetwork(expectedNetwork.ChainName);
var encoder = litecoin.GetBech32Encoder(Bech32Type.WITNESS_PUBKEY_ADDRESS, true);

var decoded = encoder.Decode(address, out var witVersion);
var result = new WitKeyId(decoded);

Debug.Assert(result.GetAddress(litecoin).ToString() == address);
return result;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ public class BitcoinPoolConfigExtra
{
public BitcoinAddressType AddressType { get; set; } = BitcoinAddressType.Legacy;

public string BechPrefix { get; set; } = "bc";

/// <summary>
/// Maximum number of tracked jobs.
/// Default: 12 - you should increase this value if your blockrefreshinterval is higher than 300ms
Expand Down

0 comments on commit e645b21

Please sign in to comment.