mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-02 13:37:24 +00:00
Fix: Block headers received (save to fullstore) that are >80 in length i.e includes tx. Tx are removed when saving the header.
This commit is contained in:
committed by
Mike Hearn
parent
1d96e1ad1d
commit
b11c17a5f6
@@ -664,14 +664,15 @@ public abstract class AbstractBlockChain {
|
||||
// Walk in ascending chronological order.
|
||||
for (Iterator<StoredBlock> it = newBlocks.descendingIterator(); it.hasNext();) {
|
||||
cursor = it.next();
|
||||
if (expensiveChecks && cursor.getHeader().getTimeSeconds() <= getMedianTimestampOfRecentBlocks(cursor.getPrev(blockStore), blockStore))
|
||||
Block cursorBlock = cursor.getHeader();
|
||||
if (expensiveChecks && cursorBlock.getTimeSeconds() <= getMedianTimestampOfRecentBlocks(cursor.getPrev(blockStore), blockStore))
|
||||
throw new VerificationException("Block's timestamp is too early during reorg");
|
||||
TransactionOutputChanges txOutChanges;
|
||||
if (cursor != newChainHead || block == null)
|
||||
txOutChanges = connectTransactions(cursor);
|
||||
else
|
||||
txOutChanges = connectTransactions(newChainHead.getHeight(), block);
|
||||
storedNewHead = addToBlockStore(storedNewHead, cursor.getHeader(), txOutChanges);
|
||||
storedNewHead = addToBlockStore(storedNewHead, cursorBlock.cloneAsHeader(), txOutChanges);
|
||||
}
|
||||
} else {
|
||||
// (Finally) write block to block store
|
||||
|
||||
@@ -619,7 +619,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto
|
||||
s.setBytes(1, hashBytes);
|
||||
s.setBytes(2, storedBlock.getChainWork().toByteArray());
|
||||
s.setInt(3, storedBlock.getHeight());
|
||||
s.setBytes(4, storedBlock.getHeader().unsafeBitcoinSerialize());
|
||||
s.setBytes(4, storedBlock.getHeader().cloneAsHeader().unsafeBitcoinSerialize());
|
||||
s.setBoolean(5, wasUndoable);
|
||||
s.executeUpdate();
|
||||
s.close();
|
||||
|
||||
Reference in New Issue
Block a user