Commit 2ae2f379 authored by Sergei Zubov's avatar Sergei Zubov

Modify fee calculation precision

parent 12cc234a
...@@ -35,7 +35,7 @@ namespace Stratis.Bitcoin.Features.Consensus.Rules.CommonRules ...@@ -35,7 +35,7 @@ namespace Stratis.Bitcoin.Features.Consensus.Rules.CommonRules
$"Rule context must be {nameof(DeStreamPowRuleContext)} or {nameof(DeStreamRuleContext)}"); $"Rule context must be {nameof(DeStreamPowRuleContext)} or {nameof(DeStreamRuleContext)}");
} }
if (Math.Abs(actualFee - expectedFee) > Money.CENT) if (Math.Abs(actualFee - expectedFee) > 1)
ConsensusErrors.BadTransactionFeeOutOfRange.Throw(); ConsensusErrors.BadTransactionFeeOutOfRange.Throw();
return Task.CompletedTask; return Task.CompletedTask;
...@@ -70,7 +70,7 @@ namespace Stratis.Bitcoin.Features.Consensus.Rules.CommonRules ...@@ -70,7 +70,7 @@ namespace Stratis.Bitcoin.Features.Consensus.Rules.CommonRules
double feeInTransaction = transaction.Outputs double feeInTransaction = transaction.Outputs
.Where(p => !changeScriptPubKeys.Contains(p.ScriptPubKey)) .Where(p => !changeScriptPubKeys.Contains(p.ScriptPubKey))
.Sum(p => p.Value) * this.Parent.Network.FeeRate; .Sum(p => p.Value) * this.Parent.Network.FeeRate;
if (Math.Abs(totalIn.Satoshi - transaction.TotalOut.Satoshi - feeInTransaction) > Money.CENT) if (Math.Abs(totalIn.Satoshi - transaction.TotalOut.Satoshi - feeInTransaction) > 1)
ConsensusErrors.BadTransactionFeeOutOfRange.Throw(); ConsensusErrors.BadTransactionFeeOutOfRange.Throw();
return (long) (feeInTransaction * this.Parent.Network.DeStreamFeePart); return (long) (feeInTransaction * this.Parent.Network.DeStreamFeePart);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment