Skip to content

Commit

Permalink
Reject transactions which emit Qi UTXOs to inactive chains
Browse files Browse the repository at this point in the history
  • Loading branch information
wizeguyy committed Dec 4, 2024
1 parent fae4919 commit be33e41
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,21 @@ func (pool *TxPool) addQiTxs(txs types.Transactions) []error {
if etxPLimit < params.ETXPLimitMin {
etxPLimit = params.ETXPLimitMin
}
activeLocations := common.NewChainsAdded(pool.chain.CurrentBlock().ExpansionNumber())
transactionsWithoutErrors := make([]*types.TxWithMinerFee, 0, len(txs))
for _, tx := range txs {
// Reject TX if it emits an output to an inactive chain
for _, txo := range tx.TxOut() {
found := false
for _, activeLoc := range activeLocations {
if common.IsInChainScope(txo.Address, activeLoc) {
found = true
}
}
if !found {
errs = append(errs, fmt.Errorf("Qi TXO emitted to an inactive chain"))
}
}

totalQitIn, err := ValidateQiTxInputs(tx, pool.chain, pool.db, currentBlock, pool.signer, pool.chainconfig.Location, *pool.chainconfig.ChainID)
if err != nil {
Expand Down

0 comments on commit be33e41

Please sign in to comment.