@@ -1702,6 +1702,7 @@ int main(int argc, char* argv[]) {
17021702 utxo = ltc_utxo_cache.get (),
17031703 utxo_db = ltc_utxo_db.get (),
17041704 bcaster = embedded_broadcaster.get (),
1705+ coinbase_maturity = core::coin::LTC_LIMITS .coinbase_maturity ,
17051706 &web_server](
17061707 const std::string& peer,
17071708 const ltc::coin::BlockType& block) {
@@ -1744,12 +1745,14 @@ int main(int argc, char* argv[]) {
17441745 mempool_requested = true ;
17451746 LOG_INFO << " [EMB-LTC] UTXO ready — enabled BIP 35 mempool sync" ;
17461747
1747- // Bootstrap: request last 10 full blocks to seed UTXO.
1748- // Ensures mempool fee computation has enough UTXOs from
1749- // the start, instead of waiting for new blocks to arrive.
1748+ // Bootstrap: request historical blocks to seed UTXO.
1749+ // Depth = coinbase_maturity (100 for LTC/DOGE): any
1750+ // mempool tx spending a coinbase output needs its input
1751+ // block in our UTXO set, and coinbase outputs mature
1752+ // after exactly this many confirmations.
17501753 if (chain && utxo_db->get_best_height () <= height) {
17511754 int requested = 0 ;
1752- for (int bi = 1 ; bi <= 10 && static_cast < int >(height) - bi >= 0 ; ++bi) {
1755+ for (uint32_t bi = 1 ; bi <= coinbase_maturity && bi <= height ; ++bi) {
17531756 auto entry = chain->get_header_by_height (height - bi);
17541757 if (entry) {
17551758 bcaster->request_full_block (entry->block_hash );
@@ -3697,6 +3700,7 @@ int main(int argc, char* argv[]) {
36973700 utxo = doge_utxo_cache.get (),
36983701 utxo_db = doge_utxo_db.get (),
36993702 bcaster_ptr = broadcaster.get (),
3703+ coinbase_maturity = core::coin::DOGE_LIMITS .coinbase_maturity ,
37003704 &web_server](
37013705 const std::string& peer,
37023706 const ltc::coin::BlockType& block) {
@@ -3725,10 +3729,10 @@ int main(int argc, char* argv[]) {
37253729 bcaster_ptr->enable_mempool_request ();
37263730 doge_mempool_requested = true ;
37273731 LOG_INFO << " [EMB-DOGE] UTXO ready — enabled BIP 35 mempool sync" ;
3728- // Bootstrap: seed UTXO from last 10 blocks
3732+ // Bootstrap: seed UTXO with coinbase_maturity blocks
37293733 if (chain && utxo_db->get_best_height () <= height) {
37303734 int req = 0 ;
3731- for (int bi = 1 ; bi <= 10 && static_cast < int >(height) - bi >= 0 ; ++bi) {
3735+ for (uint32_t bi = 1 ; bi <= coinbase_maturity && bi <= height ; ++bi) {
37323736 auto e = chain->get_header_by_height (height - bi);
37333737 if (e) { bcaster_ptr->request_full_block (e->block_hash ); ++req; }
37343738 }
0 commit comments