Remove InputRegistrationHandler p2wpkh restriction
The restriction was redundant with with the transaction model
restriction on allowed script types, but this change is effectively a
no-op because BIP 322 validation does not implement any other script
type at the moment.
MODIFY
WalletWasabi/WabiSabi/Backend/PostRequests/InputRegistrationHandler.cs
WalletWasabi/WabiSabi/Backend/PostRequests/InputRegistrationHandler.cs
@@ -55,10 +55,6 @@ namespace WalletWasabi.WabiSabi.Backend.PostRequests
{
throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputImmature);
}
- if (!txOutResponse.TxOut.ScriptPubKey.IsScriptType(ScriptType.P2WPKH))
- {
- throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.ScriptNotAllowed);
- }
coinRoundSignaturePairs.Add(new Coin(input, txOutResponse.TxOut), inputRoundSignaturePair.RoundSignature);
}
@@ -96,6 +92,15 @@ namespace WalletWasabi.WabiSabi.Backend.PostRequests
throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputNotWhitelisted);
}
+ // Compute but don't commit updated CoinJoin to round state, it will
+ // be re-calculated on input confirmation. This is computed it here
+ // for validation purposes.
+ var state = round.CoinjoinState.AssertConstruction();
+ foreach (var coin in coins)
+ {
+ state = state.AddInput(coin);
+ }
+
foreach (var coinRoundSignaturePair in coinRoundSignaturePairs)
{
var coin = coinRoundSignaturePair.Key;
@@ -124,15 +129,6 @@ namespace WalletWasabi.WabiSabi.Backend.PostRequests
throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.TooMuchVsize);
}
- // Compute but don't commit updated CoinJoin to round state, it will
- // be re-calculated on input confirmation. This is computed it here
- // for validation purposes.
- var state = round.CoinjoinState.AssertConstruction();
- foreach (var coin in alice.Coins)
- {
- state = state.AddInput(coin);
- }
-
if (round.RemainingInputVsizeAllocation < round.PerAliceVsizeAllocation)
{
throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.VsizeQuotaExceeded);

MODIFY
WalletWasabi/WabiSabi/Models/MultipartyTransaction/ConstructionState.cs
WalletWasabi/WabiSabi/Models/MultipartyTransaction/ConstructionState.cs
@@ -28,42 +28,42 @@ namespace WalletWasabi.WabiSabi.Models.MultipartyTransaction
{
var prevout = coin.TxOut;
- if (prevout.Value <= Parameters.FeeRate.GetFee(prevout.ScriptPubKey.EstimateInputVsize()))
+ if (!StandardScripts.IsStandardScriptPubKey(prevout.ScriptPubKey))
{
- // Inputs must contribute more than they cost to spend because:
- // - Such inputs contribute nothing to privacy and may degrade it
- // because they must be paid for, when constraining sub-transactions
- // this may be useful for disambiguating between different input
- // clusters in the same way that the existence of a dust output
- // might.
- // - Space in standard transaction is limited and must be shared
- // between participants.
- throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.UneconomicalInput);
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.NonStandardInput);
}
- if (prevout.Value < Parameters.AllowedInputAmounts.Min)
+ if (!Parameters.AllowedInputTypes.Any(x => prevout.ScriptPubKey.IsScriptType(x)))
{
- throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.NotEnoughFunds);
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.ScriptNotAllowed);
}
- if (prevout.Value > Parameters.AllowedInputAmounts.Max)
+ if (!prevout.ScriptPubKey.IsScriptType(ScriptType.P2WPKH))
{
- throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.TooMuchFunds);
+ throw new NotImplementedException(); // See #5440
}
- if (!StandardScripts.IsStandardScriptPubKey(prevout.ScriptPubKey))
+ if (prevout.Value < Parameters.AllowedInputAmounts.Min)
{
- throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.NonStandardInput);
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.NotEnoughFunds);
}
- if (!prevout.ScriptPubKey.IsScriptType(ScriptType.P2WPKH))
+ if (prevout.Value > Parameters.AllowedInputAmounts.Max)
{
- throw new NotImplementedException(); // See #5440
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.TooMuchFunds);
}
- if (!Parameters.AllowedInputTypes.Any(x => prevout.ScriptPubKey.IsScriptType(x)))
+ if (prevout.Value <= Parameters.FeeRate.GetFee(prevout.ScriptPubKey.EstimateInputVsize()))
{
- throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.ScriptNotAllowed);
+ // Inputs must contribute more than they cost to spend because:
+ // - Such inputs contribute nothing to privacy and may degrade it
+ // because they must be paid for, when constraining sub-transactions
+ // this may be useful for disambiguating between different input
+ // clusters in the same way that the existence of a dust output
+ // might.
+ // - Space in standard transaction is limited and must be shared
+ // between participants.
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.UneconomicalInput);
}
if (Inputs.Any(x => x.Outpoint == coin.Outpoint))
@@ -103,6 +103,7 @@ namespace WalletWasabi.WabiSabi.Models.MultipartyTransaction
{
throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.ScriptNotAllowed);
}
+
return this with { Outputs = Outputs.Add(output) };
}

Remove InputRegistrationHandler p2wpkh restriction

The restriction was redundant with with the transaction model
restriction on allowed script types, but this change is effectively a
no-op because BIP 322 validation does not implement any other script
type at the moment.