Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Blockcore/Configuration/NodeSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public class NodeSettings : IDisposable
/// <summary>The minimum fee for a kB of transactions on the node.</summary>
public FeeRate MinTxFeeRate { get; private set; }

/// <summary>The optional maximum fee for a kB of transactions on the node.</summary>
public FeeRate MaxTxFeeRate { get; private set; }

/// <summary>The default fee for a kB of transactions on the node. This value is used if no fee is specified for
/// a transaction.
/// </summary>
Expand Down Expand Up @@ -302,6 +305,7 @@ private void LoadConfiguration()
this.MinTxFeeRate = new FeeRate(config.GetOrDefault("mintxfee", this.Network.MinTxFee, this.Logger));
this.FallbackTxFeeRate = new FeeRate(config.GetOrDefault("fallbackfee", this.Network.FallbackFee, this.Logger));
this.MinRelayTxFeeRate = new FeeRate(config.GetOrDefault("minrelaytxfee", this.Network.MinRelayTxFee, this.Logger));
this.MaxTxFeeRate = new FeeRate(config.GetOrDefault("maxtxfee", this.Network.MaxTxFee, this.Logger));
}

/// <summary>
Expand Down Expand Up @@ -400,6 +404,7 @@ public static void BuildDefaultConfigurationFile(StringBuilder builder, Network
builder.AppendLine($"regtest={(network.IsRegTest() ? 1 : 0)}");
builder.AppendLine($"#Minimum fee rate. Defaults to {network.MinTxFee}.");
builder.AppendLine($"#mintxfee={network.MinTxFee}");
builder.AppendLine($"#maxtxfee={network.MaxTxFee}");
builder.AppendLine($"#Fallback fee rate. Defaults to {network.FallbackFee}.");
builder.AppendLine($"#fallbackfee={network.FallbackFee}");
builder.AppendLine($"#Minimum relay fee rate. Defaults to {network.MinRelayTxFee}.");
Expand Down
6 changes: 5 additions & 1 deletion src/External/NBitcoin/Network.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public abstract class Network
/// </summary>
public int MaxTipAge { get; protected set; }

/// <summary>
/// The total fee this node will allow
/// </summary>
public long MaxTxFee { get; protected set; }

/// <summary>
/// Mininum fee rate for all transactions.
/// Fees smaller than this are considered zero fee for transaction creation.
Expand Down Expand Up @@ -503,7 +508,6 @@ public static T Parse<T>(string str, Network expectedNetwork) where T : IBitcoin
continue;
}
}

}

throw new FormatException("Invalid string");
Expand Down
7 changes: 3 additions & 4 deletions src/External/NBitcoin/Policy/StandardTransactionPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class StandardTransactionPolicy : ITransactionPolicy
/// <summary>
/// Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed keys
/// (remember the 520 byte limit on redeemScript size).
/// That works out to a (15*(33+1))+3=513 byte redeemScript, 513+1+15*(73+1)+3=1627 bytes of scriptSig,
/// which we round off to 1650 bytes for some minor future-proofing.
/// That works out to a (15*(33+1))+3=513 byte redeemScript, 513+1+15*(73+1)+3=1627 bytes of scriptSig,
/// which we round off to 1650 bytes for some minor future-proofing.
/// That's also enough to spend a 20-of-20 CHECKMULTISIG scriptPubKey, though such a scriptPubKey is not considered standard.
/// </summary>
public const int MaxScriptSigLength = 1650;
Expand Down Expand Up @@ -55,8 +55,7 @@ public StandardTransactionPolicy(Network network)
this.network = network;
this.ScriptVerify = NBitcoin.ScriptVerify.Standard;
this.MaxTransactionSize = 100000;
// TODO: replace fee params with whats in Network.
this.MaxTxFee = new FeeRate(Money.Coins(0.1m));
this.MaxTxFee = new FeeRate(Money.Satoshis(network.MaxTxFee));
this.MinRelayTxFee = new FeeRate(Money.Satoshis(network.MinRelayTxFee));
this.CheckFee = true;
this.CheckScriptPubKey = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public BitcoinMain()
this.MaxTimeOffsetSeconds = BitcoinMaxTimeOffsetSeconds;
this.MaxTipAge = BitcoinDefaultMaxTipAgeInSeconds;
this.MinTxFee = 1000;
this.MaxTxFee = Money.Coins(0.1m).Satoshi;
this.FallbackFee = 20000;
this.MinRelayTxFee = 1000;
this.CoinTicker = "BTC";
Expand Down
1 change: 1 addition & 0 deletions src/Networks/City/City/Networks/CityMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public CityMain()
DefaultMaxInboundConnections = 109;
MaxTipAge = 2 * 60 * 60;
MinTxFee = 4333;
MaxTxFee = Money.Coins(1).Satoshi;
FallbackFee = 4333;
MinRelayTxFee = 4333;
MaxTimeOffsetSeconds = 25 * 60;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public StratisMain()
this.DefaultAPIPort = 37221;
this.MaxTipAge = 2 * 60 * 60;
this.MinTxFee = 10000;
this.MaxTxFee = Money.Coins(1).Satoshi;
this.FallbackFee = 10000;
this.MinRelayTxFee = 10000;
this.RootFolderName = StratisRootFolderName;
Expand Down
1 change: 1 addition & 0 deletions src/Networks/Xds/Blockcore.Networks.Xds/XdsMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public XdsMain()
this.DefaultBanTimeSeconds = 8000;
this.MaxTipAge = 2 * 60 * 60;
this.MinTxFee = Money.Coins(0.00001m).Satoshi;
this.MaxTxFee = Money.Coins(1).Satoshi;
this.FallbackFee = this.MinTxFee;
this.MinRelayTxFee = this.MinTxFee;
this.AbsoluteMinTxFee = Money.Coins(0.01m).Satoshi;
Expand Down
1 change: 1 addition & 0 deletions src/Networks/x42/x42/Networks/x42Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public x42Main()
this.DefaultMaxInboundConnections = 109;
this.MaxTipAge = 2 * 60 * 60;
this.MinTxFee = Money.Zero;
this.MaxTxFee = Money.Coins(1).Satoshi;
this.FallbackFee = Money.Zero;
this.MinRelayTxFee = Money.Zero;
this.MaxTimeOffsetSeconds = 25 * 60;
Expand Down