forked from Qortal/qortal
Moved relocation code from isDataLocal() to onImportAsUnconfirmed()
It's not good to be moving files around in a method that should really be read only. This also adds an intentional checkAndRelocateMiscFiles() call rather than relying on a call to isDataLocal() which may be removed at any time.
This commit is contained in:
parent
97cdd53861
commit
7c16a90221
@ -64,15 +64,6 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We may need to relocate files from the "misc_" folder to the signature folder
|
|
||||||
int relocatedCount = ArbitraryTransactionUtils.checkAndRelocateMiscFiles(transactionData);
|
|
||||||
if (relocatedCount > 0) {
|
|
||||||
// Files were relocated, so check again to see if they exist in the correct place
|
|
||||||
if (arbitraryDataFile.exists() || arbitraryDataFile.allChunksExist(chunkHashes)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import org.qortal.arbitrary.ArbitraryDataFileChunk;
|
|||||||
import org.qortal.transform.TransformationException;
|
import org.qortal.transform.TransformationException;
|
||||||
import org.qortal.transform.transaction.ArbitraryTransactionTransformer;
|
import org.qortal.transform.transaction.ArbitraryTransactionTransformer;
|
||||||
import org.qortal.transform.transaction.TransactionTransformer;
|
import org.qortal.transform.transaction.TransactionTransformer;
|
||||||
|
import org.qortal.utils.ArbitraryTransactionUtils;
|
||||||
|
|
||||||
public class ArbitraryTransaction extends Transaction {
|
public class ArbitraryTransaction extends Transaction {
|
||||||
|
|
||||||
@ -216,6 +217,9 @@ public class ArbitraryTransaction extends Transaction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onImportAsUnconfirmed() throws DataException {
|
protected void onImportAsUnconfirmed() throws DataException {
|
||||||
|
// We may need to move files from the misc_ folder
|
||||||
|
ArbitraryTransactionUtils.checkAndRelocateMiscFiles(arbitraryTransactionData);
|
||||||
|
|
||||||
// Invalidate the cache for this name if we have the data already
|
// Invalidate the cache for this name if we have the data already
|
||||||
if (arbitraryTransactionData.getName() != null) {
|
if (arbitraryTransactionData.getName() != null) {
|
||||||
if (isDataLocal()) {
|
if (isDataLocal()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user