[core] fix: Check CXReceipt error before init

pull/4165/head
MaxMustermann2 3 years ago
parent ec8d197f00
commit 5ff47f2f09
No known key found for this signature in database
GPG Key ID: 4F4AB9DB6FF24C94
  1. 6
      core/state_processor.go

@ -299,6 +299,9 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
var cxReceipt *types.CXReceipt
// Do not create cxReceipt if EVM call failed
if txType == types.SubtractionOnly && !failedExe {
if vmenv.CXReceipt != nil {
return nil, nil, nil, 0, errors.New("cannot have cross shard receipt via precompile and directly")
}
cxReceipt = &types.CXReceipt{
TxHash: tx.Hash(),
From: msg.From(),
@ -307,9 +310,6 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
ToShardID: tx.ToShardID(),
Amount: msg.Value(),
}
if vmenv.CXReceipt != nil {
return nil, nil, nil, 0, errors.New("cannot have cross shard receipt via precompile and directly")
}
} else {
if !failedExe {
if vmenv.CXReceipt != nil {

Loading…
Cancel
Save