diff --git a/src/Neo/Ledger/Blockchain.cs b/src/Neo/Ledger/Blockchain.cs index d9fc3e1b3f..1186a12474 100644 --- a/src/Neo/Ledger/Blockchain.cs +++ b/src/Neo/Ledger/Blockchain.cs @@ -409,7 +409,12 @@ private void Persist(Block block) using (ApplicationEngine engine = ApplicationEngine.Create(TriggerType.OnPersist, null, snapshot, block, system.Settings, 0)) { engine.LoadScript(onPersistScript); - if (engine.Execute() != VMState.HALT) throw new InvalidOperationException(); + if (engine.Execute() != VMState.HALT) + { + if (engine.FaultException != null) + throw engine.FaultException; + throw new InvalidOperationException(); + } ApplicationExecuted application_executed = new(engine); Context.System.EventStream.Publish(application_executed); all_application_executed.Add(application_executed); @@ -438,7 +443,12 @@ private void Persist(Block block) using (ApplicationEngine engine = ApplicationEngine.Create(TriggerType.PostPersist, null, snapshot, block, system.Settings, 0)) { engine.LoadScript(postPersistScript); - if (engine.Execute() != VMState.HALT) throw new InvalidOperationException(); + if (engine.Execute() != VMState.HALT) + { + if (engine.FaultException != null) + throw engine.FaultException; + throw new InvalidOperationException(); + } ApplicationExecuted application_executed = new(engine); Context.System.EventStream.Publish(application_executed); all_application_executed.Add(application_executed);