Fix mined rbf conflict prevention
This commit is contained in:
		
							parent
							
								
									ad9d9c839b
								
							
						
					
					
						commit
						a01336d8ac
					
				@ -86,19 +86,19 @@ export class Common {
 | 
				
			|||||||
        const match = spendMap.get(`${vin.txid}:${vin.vout}`);
 | 
					        const match = spendMap.get(`${vin.txid}:${vin.vout}`);
 | 
				
			||||||
        if (match && match.txid !== tx.txid) {
 | 
					        if (match && match.txid !== tx.txid) {
 | 
				
			||||||
          replaced.add(match);
 | 
					          replaced.add(match);
 | 
				
			||||||
 | 
					          // remove this tx from the spendMap
 | 
				
			||||||
 | 
					          // prevents the same tx being replaced more than once
 | 
				
			||||||
 | 
					          for (const replacedVin of match.vin) {
 | 
				
			||||||
 | 
					            const key = `${replacedVin.txid}:${replacedVin.vout}`;
 | 
				
			||||||
 | 
					            spendMap.delete(key);
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        const key = `${vin.txid}:${vin.vout}`;
 | 
				
			||||||
 | 
					        spendMap.delete(key);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (replaced.size) {
 | 
					      if (replaced.size) {
 | 
				
			||||||
        matches[tx.txid] = { replaced: Array.from(replaced), replacedBy: tx };
 | 
					        matches[tx.txid] = { replaced: Array.from(replaced), replacedBy: tx };
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      // remove this tx from the spendMap
 | 
					 | 
				
			||||||
      // prevents the same tx being replaced more than once
 | 
					 | 
				
			||||||
      for (const vin of tx.vin) {
 | 
					 | 
				
			||||||
        const key = `${vin.txid}:${vin.vout}`;
 | 
					 | 
				
			||||||
        if (spendMap.get(key)?.txid === tx.txid) {
 | 
					 | 
				
			||||||
          spendMap.delete(key);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return matches;
 | 
					    return matches;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user