Skip to content
Merged
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
15 changes: 4 additions & 11 deletions src/Nethermind/Nethermind.Serialization.Rlp/TxDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,7 @@ static Span<byte> DecodeTxType(RlpStream rlpStream, int length, out TxType txTyp
transactionSequence = DecodeTxType(rlpStream, rlpStream.ReadPrefixAndContentLength().ContentLength, out txType);
}


return transactionSequence;


}

private static Hash256 CalculateHashForNetworkPayloadForm(TxType type, Span<byte> transactionSequence)
Expand Down Expand Up @@ -521,10 +518,7 @@ private static void DecodeSignature(
ulong v = rlpStream.DecodeULong();
ReadOnlySpan<byte> rBytes = rlpStream.DecodeByteArraySpan();
ReadOnlySpan<byte> sBytes = rlpStream.DecodeByteArraySpan();
if (!(v == 0 && rBytes.IsEmpty && sBytes.IsEmpty))
{
ApplySignature(transaction, v, rBytes, sBytes, rlpBehaviors);
}
ApplySignature(transaction, v, rBytes, sBytes, rlpBehaviors);
}

private static void DecodeSignature(
Expand All @@ -535,10 +529,7 @@ private static void DecodeSignature(
ulong v = decoderContext.DecodeULong();
ReadOnlySpan<byte> rBytes = decoderContext.DecodeByteArraySpan();
ReadOnlySpan<byte> sBytes = decoderContext.DecodeByteArraySpan();
if (!(v == 0 && rBytes.IsEmpty && sBytes.IsEmpty))
{
ApplySignature(transaction, v, rBytes, sBytes, rlpBehaviors);
}
ApplySignature(transaction, v, rBytes, sBytes, rlpBehaviors);
}

private static void ApplySignature(
Expand All @@ -548,6 +539,8 @@ private static void ApplySignature(
ReadOnlySpan<byte> sBytes,
RlpBehaviors rlpBehaviors)
{
if (transaction.Type == TxType.DepositTx && v == 0 && rBytes.IsEmpty && sBytes.IsEmpty) return;

bool allowUnsigned = (rlpBehaviors & RlpBehaviors.AllowUnsigned) == RlpBehaviors.AllowUnsigned;
bool isSignatureOk = true;
string signatureError = null;
Expand Down