Fix unmineable tx handling
This commit is contained in:
parent
d665d2a12c
commit
89d37f0058
@ -60,6 +60,7 @@ pub fn gbt(mempool: &mut ThreadTransactionsMap, accelerations: &[ThreadAccelerat
|
|||||||
indexed_accelerations[acceleration.uid as usize] = Some(acceleration);
|
indexed_accelerations[acceleration.uid as usize] = Some(acceleration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info!("Initializing working vecs with uid capacity for {}", max_uid + 1);
|
||||||
let mempool_len = mempool.len();
|
let mempool_len = mempool.len();
|
||||||
let mut audit_pool: AuditPool = Vec::with_capacity(max_uid + 1);
|
let mut audit_pool: AuditPool = Vec::with_capacity(max_uid + 1);
|
||||||
audit_pool.resize(max_uid + 1, None);
|
audit_pool.resize(max_uid + 1, None);
|
||||||
@ -127,8 +128,8 @@ pub fn gbt(mempool: &mut ThreadTransactionsMap, accelerations: &[ThreadAccelerat
|
|||||||
let next_from_stack = next_valid_from_stack(&mut mempool_stack, &audit_pool);
|
let next_from_stack = next_valid_from_stack(&mut mempool_stack, &audit_pool);
|
||||||
let next_from_queue = next_valid_from_queue(&mut modified, &audit_pool);
|
let next_from_queue = next_valid_from_queue(&mut modified, &audit_pool);
|
||||||
if next_from_stack.is_none() && next_from_queue.is_none() {
|
if next_from_stack.is_none() && next_from_queue.is_none() {
|
||||||
break;
|
info!("No transactions left! {:#?} in overflow", overflow.len());
|
||||||
}
|
} else {
|
||||||
let (next_tx, from_stack) = match (next_from_stack, next_from_queue) {
|
let (next_tx, from_stack) = match (next_from_stack, next_from_queue) {
|
||||||
(Some(stack_tx), Some(queue_tx)) => match queue_tx.cmp(stack_tx) {
|
(Some(stack_tx), Some(queue_tx)) => match queue_tx.cmp(stack_tx) {
|
||||||
std::cmp::Ordering::Less => (stack_tx, true),
|
std::cmp::Ordering::Less => (stack_tx, true),
|
||||||
@ -196,6 +197,7 @@ pub fn gbt(mempool: &mut ThreadTransactionsMap, accelerations: &[ThreadAccelerat
|
|||||||
|
|
||||||
failures = 0;
|
failures = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// this block is full
|
// this block is full
|
||||||
let exceeded_package_tries =
|
let exceeded_package_tries =
|
||||||
@ -204,6 +206,7 @@ pub fn gbt(mempool: &mut ThreadTransactionsMap, accelerations: &[ThreadAccelerat
|
|||||||
if (exceeded_package_tries || queue_is_empty) && blocks.len() < (MAX_BLOCKS - 1) {
|
if (exceeded_package_tries || queue_is_empty) && blocks.len() < (MAX_BLOCKS - 1) {
|
||||||
// finalize this block
|
// finalize this block
|
||||||
if transactions.is_empty() {
|
if transactions.is_empty() {
|
||||||
|
info!("trying to push an empty block! breaking loop! mempool {:#?} | modified {:#?} | overflow {:#?}", mempool_stack.len(), modified.len(), overflow.len());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,15 +432,16 @@ class MempoolBlocks {
|
|||||||
this.nextUid,
|
this.nextUid,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
const resultMempoolSize = blocks.reduce((total, block) => total + block.length, 0);
|
//// different number of transactions is now expected, if any were unmineable
|
||||||
if (mempoolSize !== resultMempoolSize) {
|
// const resultMempoolSize = blocks.reduce((total, block) => total + block.length, 0);
|
||||||
throw new Error('GBT returned wrong number of transactions, cache is probably out of sync');
|
// if (mempoolSize !== resultMempoolSize) {
|
||||||
} else {
|
// throw new Error('GBT returned wrong number of transactions, cache is probably out of sync');
|
||||||
|
// } else {
|
||||||
const processed = this.processBlockTemplates(newMempool, blocks, blockWeights, rates, clusters, accelerations, accelerationPool, true);
|
const processed = this.processBlockTemplates(newMempool, blocks, blockWeights, rates, clusters, accelerations, accelerationPool, true);
|
||||||
this.removeUids(removedUids);
|
this.removeUids(removedUids);
|
||||||
logger.debug(`RUST updateBlockTemplates completed in ${(Date.now() - start)/1000} seconds`);
|
logger.debug(`RUST updateBlockTemplates completed in ${(Date.now() - start)/1000} seconds`);
|
||||||
return processed;
|
return processed;
|
||||||
}
|
// }
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('RUST updateBlockTemplates failed. ' + (e instanceof Error ? e.message : e));
|
logger.err('RUST updateBlockTemplates failed. ' + (e instanceof Error ? e.message : e));
|
||||||
this.resetRustGbt();
|
this.resetRustGbt();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user