Skip to content

Commit

Permalink
Merge PR: Add two hours buffer-time before VenusHeight upgrade to clo…
Browse files Browse the repository at this point in the history
…se txPool (#1415)

* add 2 hours buffer of VenusHeight upgrade to close txPool

* optimize code
  • Loading branch information
KamiD authored Jan 11, 2022
1 parent a75b8d2 commit eed2925
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/rpc/namespaces/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,13 @@ func (api *PublicEthereumAPI) SendTransaction(args rpctypes.SendTxArgs) (common.
return common.Hash{}, err
}

//todo: after upgrade of VenusHeight, this code need to be deleted, 1800 means two hours before arriving VenusHeight
VenusTxPoolHeight := int64(0)
if tmtypes.GetVenusHeight() > 1800 {
VenusTxPoolHeight = tmtypes.GetVenusHeight() - 1800
}
// send chanData to txPool
if tmtypes.HigherThanVenus(int64(height)) && api.txPool != nil {
if (int64(height) < VenusTxPoolHeight || tmtypes.HigherThanVenus(int64(height))) && api.txPool != nil {
return broadcastTxByTxPool(api, tx, txBytes)
}

Expand Down Expand Up @@ -761,8 +766,13 @@ func (api *PublicEthereumAPI) SendRawTransaction(data hexutil.Bytes) (common.Has
}
}

//todo: after upgrade of VenusHeight, this code need to be deleted, 1800 means two hours before arriving VenusHeight
VenusTxPoolHeight := int64(0)
if tmtypes.GetVenusHeight() > 1800 {
VenusTxPoolHeight = tmtypes.GetVenusHeight() - 1800
}
// send chanData to txPool
if tmtypes.HigherThanVenus(int64(height)) && api.txPool != nil {
if (int64(height) < VenusTxPoolHeight || tmtypes.HigherThanVenus(int64(height))) && api.txPool != nil {
return broadcastTxByTxPool(api, tx, txBytes)
}

Expand Down

0 comments on commit eed2925

Please sign in to comment.