mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-30 14:52:16 +00:00
Remove redundant query in H2FullPrunedBlockStore.
Patch from Eric W Dickerson. Resolves issue 441.
This commit is contained in:
parent
f315125bf5
commit
5a3aa5d6e1
1
AUTHORS
1
AUTHORS
@ -18,3 +18,4 @@ Mark van Cuijk <phedny@gmail.com>
|
||||
Matt Corallo <git@bluematt.me>
|
||||
Alexander Lolis <alexander.lolis@gmail.com>
|
||||
Matija Mazi <matija.mazi@gmail.com>
|
||||
Eric William Dickerson <eric.w.dickerson@gmail.com>
|
||||
|
@ -686,9 +686,6 @@ public class H2FullPrunedBlockStore implements FullPrunedBlockStore {
|
||||
|
||||
public void removeUnspentTransactionOutput(StoredTransactionOutput out) throws BlockStoreException {
|
||||
maybeConnect();
|
||||
// TODO: This should only need one query (maybe a stored procedure)
|
||||
if (getTransactionOutput(out.getHash(), out.getIndex()) == null)
|
||||
throw new BlockStoreException("Tried to remove a StoredTransactionOutput from H2FullPrunedBlockStore that it didn't have!");
|
||||
try {
|
||||
PreparedStatement s = conn.get()
|
||||
.prepareStatement("DELETE FROM openOutputs WHERE hash = ? AND index = ?");
|
||||
@ -696,7 +693,10 @@ public class H2FullPrunedBlockStore implements FullPrunedBlockStore {
|
||||
// index is actually an unsigned int
|
||||
s.setInt(2, (int)out.getIndex());
|
||||
s.executeUpdate();
|
||||
int updateCount = s.getUpdateCount();
|
||||
s.close();
|
||||
if (updateCount == 0)
|
||||
throw new BlockStoreException("Tried to remove a StoredTransactionOutput from H2FullPrunedBlockStore that it didn't have!");
|
||||
} catch (SQLException e) {
|
||||
throw new BlockStoreException(e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user