forked from neo-project/neo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relocate transaction verification (neo-project#1507)
- Loading branch information
1 parent
69fb0bc
commit 22dd459
Showing
11 changed files
with
376 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Akka.Actor; | ||
using Akka.Routing; | ||
using Neo.Network.P2P.Payloads; | ||
using System; | ||
|
||
namespace Neo.Ledger | ||
{ | ||
internal class TransactionRouter : UntypedActor | ||
{ | ||
public class Task { public Transaction Transaction; public bool Relay; } | ||
|
||
private readonly IActorRef blockchain; | ||
|
||
public TransactionRouter(NeoSystem system) | ||
{ | ||
this.blockchain = system.Blockchain; | ||
} | ||
|
||
protected override void OnReceive(object message) | ||
{ | ||
if (!(message is Task task)) return; | ||
blockchain.Tell(new Blockchain.PreverifyCompleted | ||
{ | ||
Transaction = task.Transaction, | ||
Result = task.Transaction.VerifyStateIndependent(), | ||
Relay = task.Relay | ||
}, Sender); | ||
} | ||
|
||
internal static Props Props(NeoSystem system) | ||
{ | ||
return Akka.Actor.Props.Create(() => new TransactionRouter(system)).WithRouter(new SmallestMailboxPool(Environment.ProcessorCount)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
|
||
namespace Neo.SmartContract | ||
{ | ||
[Flags] | ||
internal enum WitnessFlag : byte | ||
{ | ||
None = 0, | ||
|
||
StateIndependent = 0b00000001, | ||
StateDependent = 0b00000010, | ||
|
||
All = StateIndependent | StateDependent | ||
} | ||
} |
Oops, something went wrong.