mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-08-10 08:37:05 +00:00
upgrade to h2 HEAD
This commit is contained in:
@@ -321,7 +321,7 @@ public class Hwi {
|
||||
|
||||
private File getHwiHomeDir() {
|
||||
if(Platform.getCurrent() == Platform.OSX) {
|
||||
return new File(Storage.getSparrowHome(), HWI_HOME_DIR);
|
||||
return new File(Storage.getSparrowDir(), HWI_HOME_DIR);
|
||||
}
|
||||
|
||||
return new File(System.getProperty("java.io.tmpdir"));
|
||||
|
||||
@@ -14,7 +14,7 @@ public class BlockTransactionHashIndexMapper implements RowMapper<BlockTransacti
|
||||
public BlockTransactionHashIndex map(ResultSet rs, StatementContext ctx) throws SQLException {
|
||||
BlockTransactionHashIndex blockTransactionHashIndex = new BlockTransactionHashIndex(Sha256Hash.wrap(rs.getBytes("blockTransactionHashIndex.hash")),
|
||||
rs.getInt("blockTransactionHashIndex.height"), rs.getTimestamp("blockTransactionHashIndex.date"), rs.getLong("blockTransactionHashIndex.fee"),
|
||||
rs.getLong("blockTransactionHashIndex.index"), rs.getLong("blockTransactionHashIndex.value"), null, rs.getString("blockTransactionHashIndex.label"));
|
||||
rs.getLong("blockTransactionHashIndex.index"), rs.getLong("blockTransactionHashIndex.outputValue"), null, rs.getString("blockTransactionHashIndex.label"));
|
||||
blockTransactionHashIndex.setId(rs.getLong("blockTransactionHashIndex.id"));
|
||||
int statusIndex = rs.getInt("blockTransactionHashIndex.status");
|
||||
if(!rs.wasNull()) {
|
||||
|
||||
@@ -306,8 +306,11 @@ public class DbPersistence implements Persistence {
|
||||
|
||||
private void cleanAndMigrate(Storage storage, String schema, String password) throws StorageException {
|
||||
try {
|
||||
boolean existing = (dataSource == null);
|
||||
Flyway flyway = getFlyway(storage, schema, password);
|
||||
flyway.clean();
|
||||
if(existing) {
|
||||
flyway.clean();
|
||||
}
|
||||
flyway.migrate();
|
||||
} catch(FlywayException e) {
|
||||
log.error("Failed to save wallet file.", e);
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
public interface WalletNodeDao {
|
||||
@SqlQuery("select walletNode.id, walletNode.derivationPath, walletNode.label, walletNode.parent, " +
|
||||
"blockTransactionHashIndex.id, blockTransactionHashIndex.hash, blockTransactionHashIndex.height, blockTransactionHashIndex.date, blockTransactionHashIndex.fee, blockTransactionHashIndex.label, " +
|
||||
"blockTransactionHashIndex.index, blockTransactionHashIndex.value, blockTransactionHashIndex.status, blockTransactionHashIndex.spentBy, blockTransactionHashIndex.node " +
|
||||
"blockTransactionHashIndex.index, blockTransactionHashIndex.outputValue, blockTransactionHashIndex.status, blockTransactionHashIndex.spentBy, blockTransactionHashIndex.node " +
|
||||
"from walletNode left join blockTransactionHashIndex on walletNode.id = blockTransactionHashIndex.node where walletNode.wallet = ? order by walletNode.parent asc nulls first, blockTransactionHashIndex.spentBy asc nulls first")
|
||||
@RegisterRowMapper(WalletNodeMapper.class)
|
||||
@RegisterRowMapper(BlockTransactionHashIndexMapper.class)
|
||||
@@ -28,11 +28,11 @@ public interface WalletNodeDao {
|
||||
@GetGeneratedKeys("id")
|
||||
long insertWalletNode(String derivationPath, String label, long wallet, Long parent);
|
||||
|
||||
@SqlUpdate("insert into blockTransactionHashIndex (hash, height, date, fee, label, index, value, status, spentBy, node) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
|
||||
@SqlUpdate("insert into blockTransactionHashIndex (hash, height, date, fee, label, index, outputValue, status, spentBy, node) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
|
||||
@GetGeneratedKeys("id")
|
||||
long insertBlockTransactionHashIndex(byte[] hash, int height, Date date, Long fee, String label, long index, long value, Integer status, Long spentBy, long node);
|
||||
|
||||
@SqlUpdate("update blockTransactionHashIndex set hash = ?, height = ?, date = ?, fee = ?, label = ?, index = ?, value = ?, status = ?, spentBy = ?, node = ? where id = ?")
|
||||
@SqlUpdate("update blockTransactionHashIndex set hash = ?, height = ?, date = ?, fee = ?, label = ?, index = ?, outputValue = ?, status = ?, spentBy = ?, node = ? where id = ?")
|
||||
void updateBlockTransactionHashIndex(byte[] hash, int height, Date date, Long fee, String label, long index, long value, Integer status, Long spentBy, long node, long id);
|
||||
|
||||
@SqlUpdate("update walletNode set label = :label where id = :id")
|
||||
|
||||
Reference in New Issue
Block a user