Skip to content

Commit 0f41fa6

Browse files
committed
workaround for block 14,874,851
1 parent d6abdf7 commit 0f41fa6

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/transaction.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ const Transaction = require('./transactions')
77
const TransactionType = Transaction.Types
88
const max_mempool = process.env.MEMPOOL_SIZE || 200
99

10+
// probably due to non standard utf8 characters that were not properly written to mongodb/bson file
11+
// for now we skip them until such bug can be reproduced
12+
const skiphash = {
13+
'7dedc07cb42c96b5013710161bf487a2488fce789b80286e3df910075f98a4d1': '16de2c5c847962f3683aec852072e702fb8c4ffd81c3d23cf85b8d2da031bd8e' // tx in block 14,874,851
14+
}
15+
1016
transaction = {
1117
pool: [], // the pool holds temporary txs that havent been published on chain yet
1218
eventConfirmation: new EventEmitter(),
@@ -114,7 +120,8 @@ transaction = {
114120
let newTx = cloneDeep(tx)
115121
delete newTx.signature
116122
delete newTx.hash
117-
if (CryptoJS.SHA256(JSON.stringify(newTx)).toString() !== tx.hash) {
123+
let computedHash = CryptoJS.SHA256(JSON.stringify(newTx)).toString()
124+
if (computedHash !== tx.hash && (skiphash[tx.hash] !== computedHash || (!p2p.recovering && chain.getLatestBlock()._id > chain.restoredBlocks))) {
118125
cb(false, 'invalid tx hash does not match'); return
119126
}
120127
// checking transaction signature

0 commit comments

Comments
 (0)