Merge pull request #4749 from mempool/mononaut/fake-p2wsh-goggles
Add fake p2wsh goggles
This commit is contained in:
		
						commit
						7bedb9488b
					
				| @ -293,7 +293,6 @@ export class Common { | |||||||
|         } |         } | ||||||
|         if (vout.value < (dustSize * DUST_RELAY_TX_FEE)) { |         if (vout.value < (dustSize * DUST_RELAY_TX_FEE)) { | ||||||
|           // under minimum output size
 |           // under minimum output size
 | ||||||
|           console.log(`NON-STANDARD | dust | ${vout.value} | ${dustSize} ${dustSize * DUST_RELAY_TX_FEE} `, tx.txid); |  | ||||||
|           return true; |           return true; | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
| @ -456,6 +455,8 @@ export class Common { | |||||||
|       flags |= TransactionFlags.no_rbf; |       flags |= TransactionFlags.no_rbf; | ||||||
|     } |     } | ||||||
|     let hasFakePubkey = false; |     let hasFakePubkey = false; | ||||||
|  |     let P2WSHCount = 0; | ||||||
|  |     let olgaSize = 0; | ||||||
|     for (const vout of tx.vout) { |     for (const vout of tx.vout) { | ||||||
|       switch (vout.scriptpubkey_type) { |       switch (vout.scriptpubkey_type) { | ||||||
|         case 'p2pk': { |         case 'p2pk': { | ||||||
| @ -483,6 +484,20 @@ export class Common { | |||||||
|       if (vout.scriptpubkey_address) { |       if (vout.scriptpubkey_address) { | ||||||
|         reusedOutputAddresses[vout.scriptpubkey_address] = (reusedOutputAddresses[vout.scriptpubkey_address] || 0) + 1; |         reusedOutputAddresses[vout.scriptpubkey_address] = (reusedOutputAddresses[vout.scriptpubkey_address] || 0) + 1; | ||||||
|       } |       } | ||||||
|  |       if (vout.scriptpubkey_type === 'v0_p2wsh') { | ||||||
|  |         if (!P2WSHCount) { | ||||||
|  |           olgaSize = parseInt(vout.scriptpubkey.slice(4, 8), 16); | ||||||
|  |         } | ||||||
|  |         P2WSHCount++; | ||||||
|  |         if (P2WSHCount === Math.ceil((olgaSize + 2) / 32)) { | ||||||
|  |           const nullBytes = (P2WSHCount * 32) - olgaSize - 2; | ||||||
|  |           if (vout.scriptpubkey.endsWith(''.padEnd(nullBytes * 2, '0'))) { | ||||||
|  |             flags |= TransactionFlags.fake_scripthash; | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       } else { | ||||||
|  |         P2WSHCount = 0; | ||||||
|  |       } | ||||||
|       outValues[vout.value || Math.random()] = (outValues[vout.value || Math.random()] || 0) + 1; |       outValues[vout.value || Math.random()] = (outValues[vout.value || Math.random()] || 0) + 1; | ||||||
|     } |     } | ||||||
|     if (hasFakePubkey) { |     if (hasFakePubkey) { | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ import cpfpRepository from '../repositories/CpfpRepository'; | |||||||
| import { RowDataPacket } from 'mysql2'; | import { RowDataPacket } from 'mysql2'; | ||||||
| 
 | 
 | ||||||
| class DatabaseMigration { | class DatabaseMigration { | ||||||
|   private static currentVersion = 71; |   private static currentVersion = 72; | ||||||
|   private queryTimeout = 3600_000; |   private queryTimeout = 3600_000; | ||||||
|   private statisticsAddedIndexed = false; |   private statisticsAddedIndexed = false; | ||||||
|   private uniqueLogs: string[] = []; |   private uniqueLogs: string[] = []; | ||||||
| @ -606,6 +606,12 @@ class DatabaseMigration { | |||||||
|       await this.$executeQuery('ALTER TABLE `federation_txos` ADD emergencyKey TINYINT NOT NULL DEFAULT 0'); |       await this.$executeQuery('ALTER TABLE `federation_txos` ADD emergencyKey TINYINT NOT NULL DEFAULT 0'); | ||||||
|       await this.updateToSchemaVersion(71); |       await this.updateToSchemaVersion(71); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     if (databaseSchemaVersion < 72 && isBitcoin === true) { | ||||||
|  |       // reindex Goggles flags for mined block templates above height 833000
 | ||||||
|  |       await this.$executeQuery('UPDATE blocks_summaries SET version = 0 WHERE height >= 832000;'); | ||||||
|  |       await this.updateToSchemaVersion(72); | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   /** |   /** | ||||||
|  | |||||||
| @ -107,6 +107,7 @@ class Mempool { | |||||||
|       if (config.MEMPOOL.CACHE_ENABLED && config.REDIS.ENABLED) { |       if (config.MEMPOOL.CACHE_ENABLED && config.REDIS.ENABLED) { | ||||||
|         await redisCache.$addTransaction(this.mempoolCache[txid]); |         await redisCache.$addTransaction(this.mempoolCache[txid]); | ||||||
|       } |       } | ||||||
|  |       this.mempoolCache[txid].flags = Common.getTransactionFlags(this.mempoolCache[txid]); | ||||||
|     } |     } | ||||||
|     if (config.MEMPOOL.CACHE_ENABLED && config.REDIS.ENABLED) { |     if (config.MEMPOOL.CACHE_ENABLED && config.REDIS.ENABLED) { | ||||||
|       await redisCache.$flushTransactions(); |       await redisCache.$flushTransactions(); | ||||||
|  | |||||||
| @ -226,6 +226,7 @@ export const TransactionFlags = { | |||||||
|   op_return:                        0b00000001_00000000_00000000_00000000n, |   op_return:                        0b00000001_00000000_00000000_00000000n, | ||||||
|   fake_pubkey:                      0b00000010_00000000_00000000_00000000n, |   fake_pubkey:                      0b00000010_00000000_00000000_00000000n, | ||||||
|   inscription:                      0b00000100_00000000_00000000_00000000n, |   inscription:                      0b00000100_00000000_00000000_00000000n, | ||||||
|  |   fake_scripthash:                  0b00001000_00000000_00000000_00000000n, | ||||||
|   // heuristics
 |   // heuristics
 | ||||||
|   coinjoin:                0b00000001_00000000_00000000_00000000_00000000n, |   coinjoin:                0b00000001_00000000_00000000_00000000_00000000n, | ||||||
|   consolidation:           0b00000010_00000000_00000000_00000000_00000000n, |   consolidation:           0b00000010_00000000_00000000_00000000_00000000n, | ||||||
|  | |||||||
| @ -40,6 +40,7 @@ export const TransactionFlags = { | |||||||
|   op_return:                        0b00000001_00000000_00000000_00000000n, |   op_return:                        0b00000001_00000000_00000000_00000000n, | ||||||
|   fake_pubkey:                      0b00000010_00000000_00000000_00000000n, |   fake_pubkey:                      0b00000010_00000000_00000000_00000000n, | ||||||
|   inscription:                      0b00000100_00000000_00000000_00000000n, |   inscription:                      0b00000100_00000000_00000000_00000000n, | ||||||
|  |   fake_scripthash:                  0b00001000_00000000_00000000_00000000n, | ||||||
|   // heuristics
 |   // heuristics
 | ||||||
|   coinjoin:                0b00000001_00000000_00000000_00000000_00000000n, |   coinjoin:                0b00000001_00000000_00000000_00000000_00000000n, | ||||||
|   consolidation:           0b00000010_00000000_00000000_00000000_00000000n, |   consolidation:           0b00000010_00000000_00000000_00000000_00000000n, | ||||||
| @ -85,6 +86,7 @@ export const TransactionFilters: { [key: string]: Filter } = { | |||||||
|     op_return: { key: 'op_return', label: 'OP_RETURN', flag: TransactionFlags.op_return, important: true }, |     op_return: { key: 'op_return', label: 'OP_RETURN', flag: TransactionFlags.op_return, important: true }, | ||||||
|     fake_pubkey: { key: 'fake_pubkey', label: 'Fake pubkey', flag: TransactionFlags.fake_pubkey }, |     fake_pubkey: { key: 'fake_pubkey', label: 'Fake pubkey', flag: TransactionFlags.fake_pubkey }, | ||||||
|     inscription: { key: 'inscription', label: 'Inscription', flag: TransactionFlags.inscription, important: true }, |     inscription: { key: 'inscription', label: 'Inscription', flag: TransactionFlags.inscription, important: true }, | ||||||
|  |     fake_scripthash: { key: 'fake_scripthash', label: 'Fake scripthash', flag: TransactionFlags.fake_scripthash }, | ||||||
|     /* heuristics */ |     /* heuristics */ | ||||||
|     coinjoin: { key: 'coinjoin', label: 'Coinjoin', flag: TransactionFlags.coinjoin, important: true }, |     coinjoin: { key: 'coinjoin', label: 'Coinjoin', flag: TransactionFlags.coinjoin, important: true }, | ||||||
|     consolidation: { key: 'consolidation', label: 'Consolidation', flag: TransactionFlags.consolidation }, |     consolidation: { key: 'consolidation', label: 'Consolidation', flag: TransactionFlags.consolidation }, | ||||||
| @ -101,7 +103,7 @@ export const FilterGroups: { label: string, filters: Filter[]}[] = [ | |||||||
|   { label: 'Features', filters: ['rbf', 'no_rbf', 'v1', 'v2', 'v3', 'nonstandard'] }, |   { label: 'Features', filters: ['rbf', 'no_rbf', 'v1', 'v2', 'v3', 'nonstandard'] }, | ||||||
|   { label: 'Address Types', filters: ['p2pk', 'p2ms', 'p2pkh', 'p2sh', 'p2wpkh', 'p2wsh', 'p2tr'] }, |   { label: 'Address Types', filters: ['p2pk', 'p2ms', 'p2pkh', 'p2sh', 'p2wpkh', 'p2wsh', 'p2tr'] }, | ||||||
|   { label: 'Behavior', filters: ['cpfp_parent', 'cpfp_child', 'replacement', 'acceleration'] }, |   { label: 'Behavior', filters: ['cpfp_parent', 'cpfp_child', 'replacement', 'acceleration'] }, | ||||||
|   { label: 'Data', filters: ['op_return', 'fake_pubkey', 'inscription'] }, |   { label: 'Data', filters: ['op_return', 'fake_pubkey', 'fake_scripthash', 'inscription'] }, | ||||||
|   { label: 'Heuristics', filters: ['coinjoin', 'consolidation', 'batch_payout'] }, |   { label: 'Heuristics', filters: ['coinjoin', 'consolidation', 'batch_payout'] }, | ||||||
|   { label: 'Sighash Flags', filters: ['sighash_all', 'sighash_none', 'sighash_single', 'sighash_default', 'sighash_acp'] }, |   { label: 'Sighash Flags', filters: ['sighash_all', 'sighash_none', 'sighash_single', 'sighash_default', 'sighash_acp'] }, | ||||||
| ].map(group => ({ label: group.label, filters: group.filters.map(filter => TransactionFilters[filter] || null).filter(f => f != null) })); | ].map(group => ({ label: group.label, filters: group.filters.map(filter => TransactionFilters[filter] || null).filter(f => f != null) })); | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user