mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-05-25 00:33:20 +08:00
feat: add a miner-driven mempool submission function so that the miner can add its own transactions while bypassing the usual checks that would prevent them (such as fees or nonce conflicts). Used to submit poison-microblock transactions
This commit is contained in:
@@ -1732,6 +1732,34 @@ impl MemPoolDB {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Miner-driven submit (e.g. for poison microblocks), where no checks are performed
|
||||
pub fn miner_submit(
|
||||
&mut self,
|
||||
chainstate: &mut StacksChainState,
|
||||
consensus_hash: &ConsensusHash,
|
||||
block_hash: &BlockHeaderHash,
|
||||
tx: &StacksTransaction,
|
||||
event_observer: Option<&dyn MemPoolEventDispatcher>,
|
||||
miner_estimate: f64,
|
||||
) -> Result<(), MemPoolRejection> {
|
||||
let mut mempool_tx = self.tx_begin().map_err(MemPoolRejection::DBError)?;
|
||||
|
||||
let fee_estimate = Some(miner_estimate);
|
||||
|
||||
MemPoolDB::tx_submit(
|
||||
&mut mempool_tx,
|
||||
chainstate,
|
||||
consensus_hash,
|
||||
block_hash,
|
||||
tx,
|
||||
false,
|
||||
event_observer,
|
||||
fee_estimate,
|
||||
)?;
|
||||
mempool_tx.commit().map_err(MemPoolRejection::DBError)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Directly submit to the mempool, and don't do any admissions checks.
|
||||
/// This method is only used during testing, but because it is used by the
|
||||
/// integration tests, it cannot be marked #[cfg(test)].
|
||||
|
||||
Reference in New Issue
Block a user