Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bloom filter with empty verification script #1965

Merged
merged 3 commits into from
Sep 25, 2020
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
2 changes: 1 addition & 1 deletion src/neo/Cryptography/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static byte[] Sha256(this Span<byte> value)
internal static bool Test(this BloomFilter filter, Transaction tx)
{
if (filter.Check(tx.Hash.ToArray())) return true;
if (tx.Witnesses.Any(p => filter.Check(p.ScriptHash.ToArray())))
if (tx.Signers.Any(p => filter.Check(p.Account.ToArray())))
return true;
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion tests/neo.UnitTests/Cryptography/UT_Cryptography_Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Neo.Cryptography;
using Neo.IO;
using Neo.Network.P2P.Payloads;
using Neo.SmartContract;
using System;
using System.Security;
using System.Text;
Expand Down Expand Up @@ -153,7 +154,7 @@ public void TestTest()
{
Script = TestUtils.GetByteArray(32, 0x42),
SystemFee = 4200000000,
Signers = Array.Empty<Signer>(),
Signers = new Signer[] { new Signer() { Account = (new byte[0]).ToScriptHash() } },
Attributes = Array.Empty<TransactionAttribute>(),
Witnesses = new[]
{
Expand Down