mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-11 17:55:53 +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>
|
Matt Corallo <git@bluematt.me>
|
||||||
Alexander Lolis <alexander.lolis@gmail.com>
|
Alexander Lolis <alexander.lolis@gmail.com>
|
||||||
Matija Mazi <matija.mazi@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 {
|
public void removeUnspentTransactionOutput(StoredTransactionOutput out) throws BlockStoreException {
|
||||||
maybeConnect();
|
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 {
|
try {
|
||||||
PreparedStatement s = conn.get()
|
PreparedStatement s = conn.get()
|
||||||
.prepareStatement("DELETE FROM openOutputs WHERE hash = ? AND index = ?");
|
.prepareStatement("DELETE FROM openOutputs WHERE hash = ? AND index = ?");
|
||||||
@ -696,7 +693,10 @@ public class H2FullPrunedBlockStore implements FullPrunedBlockStore {
|
|||||||
// index is actually an unsigned int
|
// index is actually an unsigned int
|
||||||
s.setInt(2, (int)out.getIndex());
|
s.setInt(2, (int)out.getIndex());
|
||||||
s.executeUpdate();
|
s.executeUpdate();
|
||||||
|
int updateCount = s.getUpdateCount();
|
||||||
s.close();
|
s.close();
|
||||||
|
if (updateCount == 0)
|
||||||
|
throw new BlockStoreException("Tried to remove a StoredTransactionOutput from H2FullPrunedBlockStore that it didn't have!");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new BlockStoreException(e);
|
throw new BlockStoreException(e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user